php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46610 ReflectionMethod->invokeArgs(), &UNKNOWN
Submitted: 2008-11-19 10:08 UTC Modified: 2008-11-27 01:00 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: danil dot megrabjan at gmail dot com Assigned:
Status: No Feedback Package: Reflection related
PHP Version: 5.2.6 OS: openSUSE11
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-11-19 10:08 UTC] 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)
}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-11-19 10:58 UTC] jani@php.net
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.


 [2008-11-27 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Dec 05 23:03:42 2021 UTC