Bug #64346 [Com]: Function name resolution and eval
| From: | Terry at ellisons dot org dot uk | Date: | Sun, 08 Dec 2013 16:16:26 +0000 |
| Subject: | Bug #64346 [Com]: Function name resolution and eval | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183196@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
Comment by: Terry at ellisons dot org dot uk
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:
BTW, the title of this bug is misleading. It can still occur for *any* INCLUDE_OR_EVAL of a
namespaced override of a builtin function, eg.
namespace fred;
some_function_which_executes_builtin();
include "some_include_in_namespace_fred_which overrides_same_builtin();
some_function_which_executes_builtin();
Previous Comments:
------------------------------------------------------------------------
[2013-12-02 16:57:46] Terry at ellisons dot org dot uk
Dmitry,
I came across this one myself (see http://3v4l.org/KSIDh) and
found this bugrep when I came to report it.
I think that one-time caching as we've started to do with function look-up is an important
performance feature, and something that we should look to extend -- though this is a wider
discussion than this bugrep, probably a DL list discussion.
I haven't gone through the current implementation yet, but my immediate thought is that this
really just a cache-coherence issue in a cache where the invalidation rates are very low, so even if
cache flushing was a relatively expensive operation, then the expected (that is average) overhead
would still be small. I want to think about this some more and look at the performance issues
around some approaches, before posting further -- Terry
------------------------------------------------------------------------
[2013-04-12 06:50:51] laruence@php.net
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
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
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