php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70595 Generating phar.phar failed under OS X 10.11
Submitted: 2015-09-28 03:55 UTC Modified: -
Votes:2
Avg. Score:2.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: 191919 at gmail dot com Assigned:
Status: Open Package: Compile Failure
PHP Version: 7.0Git-2015-09-28 (Git) OS: OS X
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-09-28 03:55 UTC] 191919 at gmail dot com
Description:
------------
dev failed to build under OS X 10.11 when generating phar.phar.

```
$ rm -rf /opt/php7
$ ./buildconf
$ ./configure --prefix=/opt/php7 --enable-opcache
$ make
...
...
...
Generating phar.phar

Parse error: syntax error, unexpected end of file in /Users/XX/box/php-src/ext/phar/phar.php on line 3
make: *** [ext/phar/phar.phar] Error 255
```

I checked the generated phar.php, which looks like an error message output elsewhere.

```
$ cat /Users/XX/box/php-src/ext/phar/phar.php

Parse error: syntax error, unexpected ''<'' (T_ENCAPSED_AND_WHITESPACE), expecting '(' in /Users/XX/box/php-src/ext/phar/build_precommand.php on line 2
```

build_precommand.php looks like totally valid:

```
$ cat /Users/XX/box/php-src/ext/phar/build_precommand.php
#!/usr/bin/php
<?php echo '<'.'?php';?>

/** @file phar.php
 * @ingroup Phar
 * @brief class Phar Pre Command
 * @author  Marcus Boerger
 * @date    2007 - 2008
 *
 * Phar Command
 */
foreach(array("SPL", "Reflection", "Phar") as $ext) {
        if (!extension_loaded($ext)) {
                echo "$argv[0] requires PHP extension $ext.\n";
                exit(1);
        }
}

<?php

$classes = array(
        'DirectoryTreeIterator',
        'DirectoryGraphIterator',
        'InvertedRegexIterator',
        'CLICommand',
        'PharCommand',
        );

foreach($classes as $name) {
        echo "if (!class_exists('$name', 0))\n{\n";
        $f = file(dirname(__FILE__) . '/phar/' . strtolower($name) . '.inc');
        unset($f[0]);
        $c = count($f);
        while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
                unset($f[$c--]);
        }
        if (substr($f[$c], -2) == "\r\n") {
                $f[$c] = substr($f[$c], 0, -2);
        }
        if (substr($f[$c], -1) == "\n") {
                $f[$c] = substr($f[$c], 0, -1);
        }
        if (substr($f[$c], -2) == '?>') {
                $f[$c] = substr($f[$c], 0,-2);
        }
        while ($c && (strlen($f[$c]) == 0 || $f[$c] == "\n" || $f[$c] == "\r\n")) {
                unset($f[$c--]);
        }
        echo join('', $f);
        echo "\n}\n\n";
}

echo 'new PharCommand($argc, $argv);'."\n";

?>
```



Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Sep 18 14:01:37 2019 UTC