Bug #65999 [Opn->Fbk]: autoloading of aliased namespaced classes fails when including twice a file

From: Date: Wed, 30 Oct 2013 14:48:28 +0000
Subject: Bug #65999 [Opn->Fbk]: autoloading of aliased namespaced classes fails when including twice a file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182499@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65999&edit=1 ID: 65999 Updated by: nikic@php.net Reported by: giunta dot gaetano at gmail dot com Summary: autoloading of aliased namespaced classes fails when including twice a file -Status: Open +Status: Feedback Type: Bug Package: *General Issues Operating System: win7 64bit PHP Version: 5.4.21 Block user comment: N Private report: N New Comment: Could you please provide a short reproduce script for your issue? I tried the following code, which autoloaded 'A\B\C', not 'D': <?php use A\B\C as D; if (!isset($alreadyIncluded)) { spl_autoload_register('var_dump'); $alreadyIncluded = true; include __FILE__; } else { new D; } Previous Comments: ------------------------------------------------------------------------ [2013-10-30 10:50:08] giunta dot gaetano at gmail dot com [edited bug name] ------------------------------------------------------------------------ [2013-10-30 10:49:20] giunta dot gaetano at gmail dot com Description: ------------ Imagine the following situation: - file X.php has a USE statement aliasing a class name A\B\C as D - it includes other files, which set up autoloading, then require X.php again - when X.php is reincluded, it executes some code, using an object: $x = new D() In this case, the functions registered for class autoloading will get passed the string 'D' instead of 'A\B\C' ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65999&edit=1

« previous php.bugs (#182499) next »