From:             andrea at 3site dot it
Operating system: Windows XP
PHP version:      5.2.5
PHP Bug Type:     Scripting Engine problem
Bug description:  new ReflectionFunction fails to invoke native functions

Description:
------------
For some reason, ReflectionFunction doesn't allow me to to invoke a basic
function like, for example, array_unshift.

Reproduce code:
---------------
$arr = array(2, 3, 4);

/** EXPECTED RESULT
 * array_unshift($arr, 1);
 * array_unshift($arr, 0);
 * var_dump($arr);      // 0, 1, 2, 3, 4
 */

$ref = new ReflectionFunction('array_unshift');

// WARNING: Call-time pass-by-reference has been deprecated
$ref->invoke(&$arr, 1);
$ref->invokeArgs(array(&$arr, 0));
var_dump($arr); // correct and expected result

// FATAL ERROR - Uncaught exception 'ReflectionException' with message
'Invocation of function array_unshift() failed'
$ref->invoke($arr, 1);
$ref->invokeArgs(array($arr, 0));
var_dump($arr); // nothing, because of fatal error ... 

exit;

Expected result:
----------------
I would like to do what I'm trying to do without errors.
I mean both fatal and warning.

Actual result:
--------------
An illogical problem for a simple operation.

You have a "passed by reference" in your core but you choosed to disable
send by reference in PHP ... and ReflectionFunction doesn't seem to be able
to manage this kind of "situation".

Please do not reply with something like: change your PHP configuration ...
I would like to write not deprecated code. Thank You.

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

Reply via email to