FAQ
Hi,

today I was running into an issue with a function lookup over namespace.

https://3v4l.org/qF7cK fails
https://3v4l.org/evVic works

For me it looks like the function lookup for "is_null" in this case gets
cached on first use
and on second call no check will be done if this function exists in the
current namespace
before looking in the root namespace.

Because PHP is a dynamic language this behavior looks wrong
(unexpected) to me
and also HHVM does handle it as I would expect it.

Thanks,
Marc

Search Discussions

  • Nikita Popov at May 31, 2016 at 7:59 pm

    On Tue, May 31, 2016 at 9:54 PM, Marc Bennewitz wrote:

    Hi,

    today I was running into an issue with a function lookup over namespace.

    https://3v4l.org/qF7cK fails
    https://3v4l.org/evVic works

    For me it looks like the function lookup for "is_null" in this case gets
    cached on first use
    and on second call no check will be done if this function exists in the
    current namespace
    before looking in the root namespace.

    Because PHP is a dynamic language this behavior looks wrong (unexpected)
    to me
    and also HHVM does handle it as I would expect it.

    Thanks,
    Marc
    This is a known issue: https://bugs.php.net/bug.php?id=64346

    Regards,
    Nikita
  • Marc Bennewitz at May 31, 2016 at 8:14 pm

    On 05/31/2016 09:59 PM, Nikita Popov wrote:
    On Tue, May 31, 2016 at 9:54 PM, Marc Bennewitz wrote:

    Hi,

    today I was running into an issue with a function lookup over
    namespace.

    https://3v4l.org/qF7cK fails
    https://3v4l.org/evVic works

    For me it looks like the function lookup for "is_null" in this
    case gets cached on first use
    and on second call no check will be done if this function exists
    in the current namespace
    before looking in the root namespace.

    Because PHP is a dynamic language this behavior looks wrong
    (unexpected) to me
    and also HHVM does handle it as I would expect it.

    Thanks,
    Marc


    This is a known issue: https://bugs.php.net/bug.php?id=64346
    Much thanks Nikita for the link. Didn't found it myself.

    But this bug ticket doesn't look nice - No comments since 2¹/² years.

    Is a suggestion from someone without enough knowledge of the engine /
    opcache.
    Wouldn't it be better to move this performance feature into opcache and
    make it configurable over "opcache.optimization_level
    <http://php.net/manual/en/opcache.configuration.php#ini.opcache.optimization-level>"?
    Regards,
    Nikita
    Thanks,
    Marc

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupphp-internals @
categoriesphp
postedMay 31, '16 at 7:54p
activeMay 31, '16 at 8:14p
posts3
users2
websitephp.net

2 users in discussion

Marc Bennewitz: 2 posts Nikita Popov: 1 post

People

Translate

site design / logo © 2018 Grokbase