Bug #74690 [NEW]: PHP throws reference notice when using namespaces.
| From: | contact at greg dot md | Date: | Fri, 02 Jun 2017 09:14:18 +0000 |
| Subject: | Bug #74690 [NEW]: PHP throws reference notice when using namespaces. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-209356@lists.php.net to get a copy of this message | ||
From: contact at greg dot md
Operating system: Mac
PHP version: 7.1.5
Package: Scripting Engine problem
Bug Type: Bug
Bug description:PHP throws reference notice when using namespaces.
Description:
------------
When a namespace is defined in a file and you want to return a
reference, the "PHP Notice: Only variables should be assigned by
reference" is thrown.
If I delete the namespace, then it works good.
Test script:
---------------
<?php
namespace Bar;
$foo = 'foo';
$bar = &call_user_func_array(function &() use (&$foo) {
return $foo;
}, []);
$bar = 'bar';
echo $foo . PHP_EOL;
Expected result:
----------------
bar
Actual result:
--------------
PHP Notice: Only variables should be assigned by reference in
/htdocs/php-app/vendor/greg-md/php-framework/test.php on line 9
PHP Stack trace:
PHP 1. {main}()
/htdocs/php-app/vendor/greg-md/php-framework/test.php:0
Notice: Only variables should be assigned by reference in
/htdocs/php-app/vendor/greg-md/php-framework/test.php on line 9
Call Stack:
0.0002 353152 1. {main}()
/htdocs/php-app/vendor/greg-md/php-framework/test.php:0
foo
--
Edit bug report at https://bugs.php.net/bug.php?id=74690&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74690&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74690&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74690&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74690&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74690&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74690&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74690&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74690&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74690&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74690&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74690&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74690&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74690&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74690&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74690&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74690&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74690&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74690&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74690&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74690&r=mysqlcfg