From: losborn at jnrcorp dot com Operating system: Ubuntu 16.04.2 / macOS 10.12.3 PHP version: 5.6.30 Package: Testing related Bug Type: Bug Bug description:Unqualified function name doesn't always get resolved correctly
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 bug report at https://bugs.php.net/bug.php?id=74253&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74253&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74253&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74253&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74253&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74253&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74253&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74253&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74253&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74253&r=support Expected behavior: https://bugs.php.net/fix.php?id=74253&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74253&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74253&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74253&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74253&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74253&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74253&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74253&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74253&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74253&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74253&r=mysqlcfg -- PHP Quality Assurance Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php