#46610 [Opn->Fbk]: ReflectionMethod->invokeArgs(), &UNKNOWN

From: Date: Wed, 19 Nov 2008 10:58:38 +0000
Subject: #46610 [Opn->Fbk]: ReflectionMethod->invokeArgs(), &UNKNOWN
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-131100@lists.php.net to get a copy of this message
ID: 46610 Updated by: jani@php.net Reported By: danil dot megrabjan at gmail dot com -Status: Open +Status: Feedback Bug Type: Reflection related Operating System: openSUSE11 PHP Version: 5.2.6 New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Previous Comments: ------------------------------------------------------------------------ [2008-11-19 10:08:42] danil dot megrabjan at gmail dot com 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 this bug report at http://bugs.php.net/?id=46610&edit=1

« previous php.bugs (#131100) next »