Skip to content

Commit

Permalink
Don't compress PHAR and don't autoload classes that aren't in the PHAR.
Browse files Browse the repository at this point in the history
De-compression is not available on every platform (notably Heroku).
Autoloader shouldn't be greedy. Only match things we know belong to us.
  • Loading branch information
jadell committed Mar 4, 2012
1 parent 3147452 commit fcecf5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -32,7 +32,7 @@
<pharpackage <pharpackage
destfile="./neo4jphp.phar" destfile="./neo4jphp.phar"
basedir="./build" basedir="./build"
compression="gzip" compression="none"
stub="./stub.php" stub="./stub.php"
signature="sha1"> signature="sha1">
<fileset dir="./build"> <fileset dir="./build">
Expand Down
3 changes: 3 additions & 0 deletions stub.php
@@ -1,6 +1,9 @@
<?php <?php
Phar::mapPhar('neo4jphp.phar'); Phar::mapPhar('neo4jphp.phar');
spl_autoload_register(function ($className) { spl_autoload_register(function ($className) {
if (strpos($className, 'Everyman\Neo4j\\') !== 0) {
return;
}
$libPath = 'phar://neo4jphp.phar/lib/'; $libPath = 'phar://neo4jphp.phar/lib/';
$classFile = str_replace('\\',DIRECTORY_SEPARATOR,$className).'.php'; $classFile = str_replace('\\',DIRECTORY_SEPARATOR,$className).'.php';
$classPath = $libPath.$classFile; $classPath = $libPath.$classFile;
Expand Down

0 comments on commit fcecf5b

Please sign in to comment.