Fix PHP 5.2 build failure

lcfirst() isn't defined on PHP 5.2, so I added a fallback function, which
is defined in the bootstrap.php. Not sure whether that's the right place
to put it.
This commit is contained in:
nikic 2012-04-23 22:17:06 +02:00
parent 57249be44d
commit b42c9209c7
2 changed files with 11 additions and 9 deletions

View File

@ -14,14 +14,6 @@ The library needs to register a class autoloader; you can do this either by incl
require 'path/to/PHP-Parser/lib/bootstrap.php'; require 'path/to/PHP-Parser/lib/bootstrap.php';
``` ```
Or by manually registering the loader:
```php
<?php
require 'path/to/PHP-Parser/lib/PHPParser/Autoloader.php';
PHPParser_Autoloader::register();
```
Parsing Parsing
------- -------

View File

@ -1,4 +1,14 @@
<?php <?php
require dirname(__FILE__) . '/PHPParser/Autoloader.php'; require dirname(__FILE__) . '/PHPParser/Autoloader.php';
PHPParser_Autoloader::register(); PHPParser_Autoloader::register();
/*
* lcfirst() was added in PHP 5.3, so we have to emulate it for PHP 5.3.
*/
if (!function_exists('lcfirst')) {
function lcfirst($string) {
$string[0] = strtolower($string[0]);
return $string;
}
}