# Bug or expected behavior?

- Thread: https://externals.io/message/93658
- Original archive: https://news-web.php.net/php.internals/93658
- Started by Marc Bennewitz on 2016-05-31T19:54:11+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #93658 — Marc Bennewitz — 2016-05-31T19:54:11+00:00

URL: https://externals.io/message/93658#93658

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

---

## #93659 — Nikita Popov — 2016-05-31T19:59:34+00:00

URL: https://externals.io/message/93658#93659 · In reply to: #93658

> 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

---

## #93661 — Marc Bennewitz — 2016-05-31T20:13:45+00:00

URL: https://externals.io/message/93658#93661 · In reply to: #93659

> On Tue, May 31, 2016 at 9:54 PM, Marc Bennewitz <dev@mabe.berlin 
> <mailto:dev@mabe.berlin>> 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
