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: 2021-02-14 04:22 UTC
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: cmb (profile)
Status: No Feedback Package: Compile Failure
PHP Version: 7.0Git-2015-09-28 (Git) OS: OS X
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
30 - 25 = ?
Subscribe to this entry?

 
 [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

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-03 13:15 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-02-03 13:15 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-02-14 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 05:01:30 2024 UTC