Bug #74253 [Com]: Unqualified function name doesn't always get resolved correctly
| From: | losborn at jnrcorp dot com | Date: | Wed, 15 Mar 2017 20:23:05 +0000 |
| Subject: | Bug #74253 [Com]: Unqualified function name doesn't always get resolved correctly | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-207861@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74253&edit=1
ID: 74253
Comment by: losborn at jnrcorp dot com
Reported by: losborn at jnrcorp dot com
Summary: Unqualified function name doesn't always get
resolved correctly
Status: Duplicate
Type: Bug
Package: *General Issues
Operating System: Ubuntu 16.04.2 / macOS 10.12.3
PHP Version: 5.6.30
Block user comment: N
Private report: N
New Comment:
Yes, I confirmed this is a duplicate bug #64346 ... It didn't come up in my searches. Thanks
for finding it.
Previous Comments:
------------------------------------------------------------------------
[2017-03-15 20:17:50] requinix@php.net
Duplicate of bug #64346.
------------------------------------------------------------------------
[2017-03-15 20:08:46] losborn at jnrcorp dot com
Description:
------------
Unqualified function calls are supposed to resolve to functions within their namespace if they
exist. This doesn't always happen if the in-namespace function doesn't exist when the
calling function is defined.
Seen issue on 5.6.28, 5.6.30, 7.1.2
More verbose example: https://paste.laravel.io/9qgML
Test script:
---------------
<?php
namespace NotGlobalNamespace;
eval('namespace F\\o\\o; function bar($marker) { echo "$marker => " . rand() .
"\n"; }');
\F\o\o\bar(1);
eval('function bar($m) { return \F\o\o\bar($m); }');
bar(2);
eval('namespace F\\o\\o; function rand() { return "*** INTERCEPTED ***"; }');
\F\o\o\bar(3);
bar(4);
eval('namespace F\\o\\o; function baz($marker) { echo "$marker => " . rand() .
"\n"; }');
\F\o\o\baz(5);
eval('function baz($m) { return \F\o\o\baz($m); }');
baz(6);
bar(7);
Expected result:
----------------
1 => 1059777682 (random)
2 => 1332050858 (random)
3 => *** INTERCEPTED ***
4 => *** INTERCEPTED ***
5 => *** INTERCEPTED ***
6 => *** INTERCEPTED ***
7 => *** INTERCEPTED ***
Actual result:
--------------
1 => 1059777682 (random)
2 => 1332050858 (random)
3 => 1123318855 (random)
4 => 1146230506 (random)
5 => *** INTERCEPTED ***
6 => *** INTERCEPTED ***
7 => 360960634 (random)
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74253&edit=1