Bug #66107 [NEW]: func_get_args change breaks by-reference in ReflectionClass::newInstanceArgs

From: Date: Sun, 17 Nov 2013 15:24:22 +0000
Subject: Bug #66107 [NEW]: func_get_args change breaks by-reference in ReflectionClass::newInstanceArgs
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182801@lists.php.net to get a copy of this message
From:             sjon at hortensius dot net
Operating system: archlinux
PHP version:      5.5.6
Package:          Arrays related
Bug Type:         Bug
Bug description:func_get_args change breaks by-reference in ReflectionClass::newInstanceArgs

Description:
------------
The changelog states:

> Improved performance of array_merge() and func_get_args() by
eliminating useless copying.

I think I found a bug related to this change. If it's not fixed it
should at least be documented.

Test script:
---------------
From http://3v4l.org/U40T0

<?php
class f
{
    function f(&$e){}
}

function getNew()
{
    $a = func_get_args();
    $c = array_shift($a);

    $r = new ReflectionClass($c);
    return $r->newInstanceArgs($a);
}

$e = new stdClass;

var_dump(getNew('f', $e));

Expected result:
----------------
object(f)#3 (0) {
}

Actual result:
--------------
Warning: Parameter 1 to f::f() expected to be a reference, value given
in /in//in/U40T0 on line 14

Warning: ReflectionClass::newInstanceArgs(): Invocation of f's
constructor failed in /in//in/U40T0 on line 14
NULL

-- 
Edit bug report at https://bugs.php.net/bug.php?id=66107&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=66107&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=66107&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=66107&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=66107&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=66107&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=66107&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=66107&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=66107&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=66107&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=66107&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=66107&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=66107&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=66107&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66107&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=66107&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=66107&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=66107&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66107&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=66107&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=66107&r=mysqlcfg



Thread (12 messages)

« previous php.bugs (#182801) next »