From:             danil dot megrabjan at gmail dot com
Operating system: openSUSE11
PHP version:      5.2.6
PHP Bug Type:     Reflection related
Bug description:  ReflectionMethod->invokeArgs(), &UNKNOWN

Description:
------------
We have a really big php-source, i tired, but i can`t reproduce this bug
this into small simple. 

I calling method(getDataMeta) of class throw
ReflectionMethod->invokeArgs(). In this method i call another
method(getColMeta) of this class and print information about return
value(EXPECTED RESULT) - it`s OK. When i getting this value in getDataMeta
i printed dump of variable once more time(ACTUAL RESULT 1) - it`s BAD.

After invokeArgs() i print dump(ACUTAL RESULT 2) of this variable one
more(3!) time - it`s BAD as a second print.

Different between this dump`s you may see bellow in expected and actual
results. I "lost" one of item my array. In second,third times i have
&UNKNOWN instead of my object.

10x!

Reproduce code:
---------------
/* calling */
$retval = $method->invokeArgs($object, $args);
/* ACTUAL RESULT 1 */
debug_zval_dump($retval);

/* for calling throw invokeArgs */
public function getDataMeta() {
        $retval = MetaData($this->getColMeta(), $this->getRowCount());

        /* ACTUAL RESULT 2 */
        debug_zval_dump($retval);
}

/* for getDataMeta */
public function getColMeta() {          
        $retval = array();
        foreach ($this->getBase()->q->fields['list'] as $q_field) {
                if ($this->getBase()->fields->key_exists($q_field['name'])) {
                        $d_field = 
$this->getBase()->fields->items($q_field['name']);
                        if (!empty($d_field->rusName) &&
                                $d_field->isVisible) {
                                if (is_null($d_field->gridOrder)) {
                                        $d_field->gridOrder = 0;
                                }
                                
                                
$retval[MetaData::getColumnPosition(($d_field->gridOrder < 0) ? 0 :
$d_field->gridOrder, $retval)] = new MetaColumn( $q_field['name'] ... );
                        }
                }
        }
                
        if (count($retval) > 0) {
                //ksort($retval);
                $retval = array_values($retval);
        }
                
        /* EXPECTED RESULT */
        debug_zval_dump($retval);

        return $retval;
}

Expected result:
----------------
========== EXPECTED RESULT =
refcount(2){
  [0]=>
  object(MetaColumn)#654 (5) refcount(1){
    ["name"]=>
    string(10) "REGIST_NUM" refcount(2)
    ["label"]=>
    string(9) "Док. N" refcount(2)
    ["alias"]=>
    string(10) "Номер" refcount(2)
    ["width"]=>
    long(80) refcount(2)
    ["align"]=>
    string(6) "Center" refcount(2)
  }
  [1]=>
  object(MetaColumn)#655 (5) refcount(1){
    ["name"]=>
    string(3) "P44" refcount(2)
    ["label"]=>
    string(19) "Итог Сумма" refcount(2)
    ["alias"]=>
    string(18) "ИтогСумма" refcount(2)
    ["width"]=>
    long(90) refcount(2)
    ["align"]=>
    string(5) "Right" refcount(2)
  }
  [2]=>
  object(MetaColumn)#656 (5) refcount(1){
    ["name"]=>
    string(11) "REGIST_DATE" refcount(2)
    ["label"]=>
    string(8) "Дата" refcount(2)
    ["alias"]=>
    string(8) "Дата" refcount(2)
    ["width"]=>
    long(80) refcount(2)
    ["align"]=>
    string(6) "Center" refcount(2)
  }
  [3]=>
  object(MetaColumn)#657 (5) refcount(1){
    ["name"]=>
    string(9) "P4_6_NAME" refcount(2)
    ["label"]=>
    string(20) "Покупатель" refcount(2)
    ["alias"]=>
    string(28) "ПокупательНаим" refcount(2)
    ["width"]=>
    long(160) refcount(2)
    ["align"]=>
    string(4) "Left" refcount(2)
  }
  [4]=>
  object(MetaColumn)#658 (5) refcount(1){
    ["name"]=>
    string(8) "P43_NAME" refcount(2)
    ["label"]=>
    string(31) "Статус документа" refcount(2)
    ["alias"]=>
    string(38) "СтатусДокументаНаим" refcount(2)
    ["width"]=>
    long(160) refcount(2)
    ["align"]=>
    string(4) "Left" refcount(2)
  }
}

Actual result:
--------------
========== ACUTAL RESULT 1 =
object(MetaData)#206 (2) refcount(2){
  ["columns"]=>
  array(5) refcount(1){
    [0]=>
    object(MetaColumn)#654 (5) refcount(1){
      ["name"]=>
      string(10) "REGIST_NUM" refcount(2)
      ["label"]=>
      string(9) "Док. N" refcount(2)
      ["alias"]=>
      string(10) "Номер" refcount(2)
      ["width"]=>
      long(80) refcount(2)
      ["align"]=>
      string(6) "Center" refcount(2)
    }
    [1]=>
    &UNKNOWN:0
    [2]=>
    object(MetaColumn)#656 (5) refcount(1){
      ["name"]=>
      string(11) "REGIST_DATE" refcount(2)
      ["label"]=>
      string(8) "Дата" refcount(2)
      ["alias"]=>
      string(8) "Дата" refcount(2)
      ["width"]=>
      long(80) refcount(2)
      ["align"]=>
      string(6) "Center" refcount(2)
    }
    [3]=>
    object(MetaColumn)#657 (5) refcount(1){
      ["name"]=>
      string(9) "P4_6_NAME" refcount(2)
      ["label"]=>
      string(20) "Покупатель" refcount(2)
      ["alias"]=>
      string(28) "ПокупательНаим" refcount(2)
      ["width"]=>
      long(160) refcount(2)
      ["align"]=>
      string(4) "Left" refcount(2)
    }
    [4]=>
    object(MetaColumn)#658 (5) refcount(1){
      ["name"]=>
      string(8) "P43_NAME" refcount(2)
      ["label"]=>
      string(31) "Статус документа" refcount(2)
      ["alias"]=>
      string(38) "СтатусДокументаНаим" refcount(2)
      ["width"]=>
      long(160) refcount(2)
      ["align"]=>
      string(4) "Left" refcount(2)
    }
  }
  ["row_count"]=>
  long(2) refcount(2)
}

========== ACUTAL RESULT 2 =
object(MetaData)#206 (2) refcount(2){
  ["columns"]=>
  array(5) refcount(1){
    [0]=>
    object(MetaColumn)#654 (5) refcount(1){
      ["name"]=>
      string(10) "REGIST_NUM" refcount(2)
      ["label"]=>
      string(9) "Док. N" refcount(2)
      ["alias"]=>
      string(10) "Номер" refcount(2)
      ["width"]=>
      long(80) refcount(2)
      ["align"]=>
      string(6) "Center" refcount(2)
    }
    [1]=>
    &UNKNOWN:0
    [2]=>
    object(MetaColumn)#656 (5) refcount(1){
      ["name"]=>
      string(11) "REGIST_DATE" refcount(2)
      ["label"]=>
      string(8) "Дата" refcount(2)
      ["alias"]=>
      string(8) "Дата" refcount(2)
      ["width"]=>
      long(80) refcount(2)
      ["align"]=>
      string(6) "Center" refcount(2)
    }
    [3]=>
    object(MetaColumn)#657 (5) refcount(1){
      ["name"]=>
      string(9) "P4_6_NAME" refcount(2)
      ["label"]=>
      string(20) "Покупатель" refcount(2)
      ["alias"]=>
      string(28) "ПокупательНаим" refcount(2)
      ["width"]=>
      long(160) refcount(2)
      ["align"]=>
      string(4) "Left" refcount(2)
    }
    [4]=>
    object(MetaColumn)#658 (5) refcount(1){
      ["name"]=>
      string(8) "P43_NAME" refcount(2)
      ["label"]=>
      string(31) "Статус документа" refcount(2)
      ["alias"]=>
      string(38) "СтатусДокументаНаим" refcount(2)
      ["width"]=>
      long(160) refcount(2)
      ["align"]=>
      string(4) "Left" refcount(2)
    }
  }
  ["row_count"]=>
  long(2) refcount(2)
}

-- 
Edit bug report at http://bugs.php.net/?id=46610&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=46610&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=46610&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=46610&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=46610&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=46610&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=46610&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=46610&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=46610&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=46610&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=46610&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=46610&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=46610&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=46610&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=46610&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=46610&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=46610&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=46610&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=46610&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=46610&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=46610&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=46610&r=mysqlcfg

Reply via email to