# class names with and without opcache

- Thread: https://externals.io/message/74924
- Original archive: https://news-web.php.net/php.internals/74924
- Started by Greg on 2014-06-16T15:20:03+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

---

## #74924 — Greg — 2014-06-16T15:20:03+00:00

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

On a default Ubuntu setup when writing 5.5 code I noticed an
improvement with the resolution of class names such that an alias
could be used even though a similar name already exists in the same
namespace (B below). Namespace != Directory ?

namespace B;

use A\Test;

But when 5.5 opcache is disabled, the code completely falls apart,
stating that a class already exists with the same name even though
that class is not actually used or referred to by the current
script/file/class.

There is a bug report https://bugs.php.net/bug.php?id=66773, but from
the number of votes, I'm confused as to who and what is wrong - the
conflicts occur when autoloading the two independent classes.

The problem as I see it, even if I correct the aliases currently being
used, if later on a class is created with the same name as an existing
alias - then this new class will break code it has nothing to do with?

I'm at the point of believing that all classes used within a script
file should have a corresponding use statement to remove any
ambiguity?

Is this a bug? How severe is this?

If I'm missing the point, please let me know.

---

## #74991 — Greg — 2014-06-19T14:53:39+00:00

URL: https://externals.io/message/74924#74991

I've uploaded some sample code. https://github.com/devosc/opcache_disabled_test

I'd appreciate it if someone could confirm whether this is a problem
because it may not be possible to use 5.5 with opcache enabled (cli
unit tests will be broken).


> Hi Stas,
>
>
> Thank you, I appreciate this. I've uploaded some sample files to
> github, it uses composer as the autoloader
>
> https://github.com/devosc/opcache_disabled_test
>
> Even if I am wrong in my implementation, there should not be any
> difference/errors when opcache is disabled.
>
> I actually prefer the improvements provided by opcache since we don't
> have to come up with weird aliases like BaseConfigInterface.
>
>
> Regards,
>
>
> Greg
>
>
>
> 
> > […]
>
>
>
> --
> Greg



-- 
Greg

---

## #74998 — Greg — 2014-06-19T17:58:50+00:00

URL: https://externals.io/message/74924#74998 · In reply to: #74991

Ocramius suggested using travis to demonstrate the problem

https://travis-ci.org/devosc/opcache_disabled_test/jobs/27976956

The first script call (line 27) with opcache enabled does not have any
errors. However when it is disabled (line 30), it fails.

Question is, can this functionality be relied on? And which
functionality is that, the one with opcache enabled?
