# Autoloader invariant

- Thread: https://externals.io/message/51142
- Original archive: https://news-web.php.net/php.internals/51142
- Started by Edward Z. Yang on 2010-12-31T00:14:59+00:00
- Messages: 2
- 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

---

## #51142 — Edward Z. Yang — 2010-12-31T00:14:59+00:00

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

Hello all, long time no see.

When I am inside the body of an autoloader function, am I allowed
to assume the invariant that the class passed to the autoloader function
does not exist?  Last time I checked, PHP was still single-threaded,
so this invariant being broken would be quite suprising to me, but
a user reports that they are seeing precisely this behavior from a
combination of Zend Debugger + APC.

Cheers,
Edward

---

## #51143 — Stas Malyshev — 2010-12-31T00:37:30+00:00

URL: https://externals.io/message/51142#51143 · In reply to: #51142

Hi!

> When I am inside the body of an autoloader function, am I allowed
> to assume the invariant that the class passed to the autoloader function
> does not exist?  Last time I checked, PHP was still single-threaded,

Generally, yes, though nothing prevents somebody from calling the same 
function explicitly regardless of some class existence - the engine 
however wouldn't do so if the class exists.

> so this invariant being broken would be quite suprising to me, but
> a user reports that they are seeing precisely this behavior from a
> combination of Zend Debugger + APC.

I'm not sure that APC and Zend Debugger are fully compatible, but if you 
seeing this it is probably some side effect of one of these two modules. 
IIRC Zend Debugger does nothing that concerns autoloader, so I'd look at 
APC first.
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227
