Uploaded image for project: 'PHP Legacy Driver'
  1. PHP Legacy Driver
  2. PHP-308

Incorrect method declaration

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: 1.2.7
    • Fix Version/s: 1.3.2
    • Component/s: pecl-mongo
    • Labels:
      None
    • Environment:
    • # Replies:
      2
    • Last comment by Customer:
      true

      Description

      Inheriting class MongoCollection couses an error:
      Strict standards: Declaration of SdfDb_AbstractionMongoCollection::batchInsert() should be compatible with that of MongoCollection::batchInsert()

      Let`s take a look to method declaration in documenation http://php.net/manual/en/mongocollection.batchinsert.php :
      public mixed MongoCollection::batchInsert ( array $a [, array $options = array() ] )

      If we use a simple Reflection to check actual declaration:
      $reflection = new ReflectionClass( 'MongoCollection' );
      foreach ( $reflection->getMethod('batchInsert')->getParameters() as $param ) {
      var_dump( $param->getName(), $param->isArray(), $param->isOptional() );
      }

      We`ll see:

      string 'array_of_documents' (length=18)
      boolean false
      boolean false
      string 'array_of_options' (length=16)
      boolean false
      boolean true

      But correct output is:

      string 'array_of_documents' (length=18)
      boolean true
      boolean false
      string 'array_of_options' (length=16)
      boolean true
      boolean true

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since reply:
                6 years, 42 weeks, 5 days ago
                Date of 1st Reply: