Bug #64346 [PATCH]: Function name resolution and eval
| From: | laruence@php.net | Date: | Fri, 12 Apr 2013 06:50:51 +0000 |
| Subject: | Bug #64346 [PATCH]: Function name resolution and eval | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-178436@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=64346&edit=1
ID: 64346
Patch added by: laruence@php.net
Reported by: gen dot work at gmail dot com
Summary: Function name resolution and eval
Status: Assigned
Type: Bug
Package: *General Issues
Operating System: Ubuntu 12.10
PHP Version: 5.4.12
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: bug64346-2.diff
Revision: 1365749451
URL: https://bugs.php.net/patch-display.php?bug=64346&patch=bug64346-2.diff&revision=1365749451
Previous Comments:
------------------------------------------------------------------------
[2013-03-04 15:59:54] dmitry@php.net
I suppose the bug has to be fixed.
The problem that the fix will slowdown each call to unqualified function from a namespace :(
I'm not sure if we like to do it...
------------------------------------------------------------------------
[2013-03-04 14:53:34] gen dot work at gmail dot com
'\Foo\bar' -> '\Foo\time' in my prev comment
------------------------------------------------------------------------
[2013-03-04 14:50:18] gen dot work at gmail dot com
The main issue I see is that is_callabe() is lying. It says that '\Foo\bar' is callable,
but in fact it's not. So just document this behavior is not enough imo, is_callabe should be
tweaked to reflect actual status.
And I don't quite understand suggested workaraund. Could you please give a simple example? In
my usecase I try to mock time function to avoid sleep() calls:
https://github.com/rybakit/phive-queue/blob/master/tests/Phive/Tests/Queue/AbstractQueueTest.php#L59
https://github.com/rybakit/phive-queue/blob/master/src/Phive/Queue/InMemoryQueue.php#L40
------------------------------------------------------------------------
[2013-03-04 13:50:20] laruence@php.net
@gen the main brief is, when you first call to \Foo\Bar, the 'time' constant in
the \Foo\Bar function, will bundle to "time function", in the first time , it
obviously will be bundled to \time.
then when you sencond call to it. PHP will use that cache instead of look up in
function table again for "time" function, to increase performance..
so, if we disable the cache, then performance slowdown...
what do you think? a workaround is define a Foo\Bar2, after you eval, you call
to it, then it will bundled to \Foo\Time..
------------------------------------------------------------------------
[2013-03-04 13:43:29] laruence@php.net
or maybe we should document this behavior, since disable it will bring performance
issue
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64346
--
Edit this bug report at https://bugs.php.net/bug.php?id=64346&edit=1