Bug #77951 [NEW]: ReflectionReference bugs recounting
| From: | nicolas dot grekas+php at gmail dot com | Date: | Mon, 29 Apr 2019 06:40:40 +0000 |
| Subject: | Bug #77951 [NEW]: ReflectionReference bugs recounting | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220638@lists.php.net to get a copy of this message | ||
From: nicolas dot grekas+php at gmail dot com
Operating system:
PHP version: Next Minor Version
Package: Reflection related
Bug Type: Bug
Bug description:ReflectionReference bugs recounting
Description:
------------
ReflectionReference must have a bug with zval that have is_ref=1 but
refcount=1
Test script:
---------------
$a = [1, 2];
foreach ($a as &$v) {
}
// This should return null but instead it returns a
ReflectionReference.
// a few lines below, $b[0] becomes a reference to $a[0]
// while this is not the case when this line is commented.
$r = ReflectionReference::fromArrayElement($a, 0);
$b = $a;
$b[0] = 123;
var_dump($a);
var_dump($b);
Expected result:
----------------
array(2) {
[0]=>
int(1)
[1]=>
&int(2)
}
array(2) {
[0]=>
int(123)
[1]=>
&int(2)
}
Actual result:
--------------
array(2) {
[0]=>
&int(123)
[1]=>
&int(2)
}
array(2) {
[0]=>
&int(123)
[1]=>
&int(2)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=77951&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77951&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77951&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77951&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77951&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77951&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77951&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77951&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77951&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77951&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77951&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77951&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77951&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77951&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77951&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77951&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77951&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77951&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77951&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77951&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77951&r=mysqlcfg