Bug #52406 [Com]: spl_autoload support phar with namespace
| From: | jinmoku at hotmail dot com | Date: | Thu, 22 Jul 2010 23:36:47 +0000 |
| Subject: | Bug #52406 [Com]: spl_autoload support phar with namespace | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152642@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52406&edit=1
ID: 52406
Comment by: jinmoku at hotmail dot com
Reported by: jinmoku at hotmail dot com
Summary: spl_autoload support phar with namespace
Status: To be documented
Type: Bug
Package: SPL related
Operating System: XP, OSX
PHP Version: 5.3.3
New Comment:
Do u have a sample code who doesn't work with the lowercase, I want to
test in my osx ?
about :
> I can't reproduce the weird chars...
I've this in my phar
Extract_Phar::go();
__HALT_COMPILER(); ?>e
Previous Comments:
------------------------------------------------------------------------
[2010-07-23 01:22:59] felipe@php.net
I can't reproduce the weird chars...
About this is work...:
require_once('MyPhar.phar');
set_include_path('phar://' . realpath('MyPhar.phar') . PATH_SEPARATOR .
get_include_path());
require_once 'Framework/Test.php';
It's because that in this case the require_once doesn't look into the
file system at all, but into the phar structure, so it doesnt search for
the lowercased one, as in the other sample code.
------------------------------------------------------------------------
[2010-07-23 01:02:57] jinmoku at hotmail dot com
I try lowercase, but that doesn't work too, I make some tests with
spl_autoload and it's work in lower and uppercase filename.
Why in osx (i don't try with other *nix) the phar is not in the
include_path ?
it's work fine (always with the strange "��????") with this
follow code :
require_once('MyPhar.phar');
set_include_path('phar://' . realpath('MyPhar.phar') . PATH_SEPARATOR .
get_include_path());
require_once 'Framework/Test.php';
$test = new Framework\Test();
see ya ;)
------------------------------------------------------------------------
[2010-07-23 00:16:15] felipe@php.net
Hi, the spl_autoload() will try to find the 'framework/test.php', i.e.
the lowercased name, so on *nix will fail because it's case-sensitive,
and you are using $phar->addFromString('Framework/Test.php'...).
You must to use $phar->addFromString('framework/test.php', ...);
(the lowercased name to the spl_auload to find it)
------------------------------------------------------------------------
[2010-07-22 20:09:57] jinmoku at hotmail dot com
On OSX 10.6.4
output :
��???�???
Fatal error: Class 'Framework\Test' not found in
/Library/WebServer/Documents/test/index.php on line 26
require_once('Framework\Test.php');
don't run :
��????
Warning: require_once(Framework\Test.php): failed to open stream: No
such file or directory in /Library/WebServer/Documents/test/index.php on
line 26
Fatal error: require_once(): Failed opening required
'Framework\Test.php' (include_path='.:/usr/lib/php') in
/Library/WebServer/Documents/test/index.php on line 26
and phar is not in PATH include_path Windows XP
------------------------------------------------------------------------
[2010-07-22 16:13:14] jinmoku at hotmail dot com
just like http://bugs.php.net/bug.php?id=51991 ;)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/bug.php?id=52406
--
Edit this bug report at http://bugs.php.net/bug.php?id=52406&edit=1