From: cweiske
Operating system: Ubuntu Linux 13.10
PHP version: 5.6.0RC1
Package: PHAR related
Bug Type: Bug
Bug description:finfo_open does not work with phar:// magic files
Description:
------------
Packing a magic file into a phar and using finfo_open(0,
'phar://test.phar/file.magic'); does not work.
Try to create the .phar with the generator script and run it. It will
fail.
Test script:
---------------
<?php
$phar = new Phar('test.phar');
$phar->addFromString('test.magic', <<<'MGC'
0 string =<?php PHP text
!:mime text/x-php
MGC
);
$phar->setStub(<<<'PHP'
<?php
$finfo = finfo_open(0, 'phar://' . __FILE__ . '/test.magic');
__HALT_COMPILER();
?>
PHP
);
?>
Expected result:
----------------
no error.
Actual result:
--------------
$ php-5.6.0RC1 test.phar
PHP Warning: finfo_open(/tmp/test/phar): failed to open stream: No such
file or directory in /tmp/test/test.phar on line 2
Warning: finfo_open(/tmp/test/phar): failed to open stream: No such file
or directory in /tmp/test/test.phar on line 2
PHP Warning: finfo_open(/tmp/test/phar): failed to open stream: No such
file or directory in /tmp/test/test.phar on line 2
Warning: finfo_open(/tmp/test/phar): failed to open stream: No such file
or directory in /tmp/test/test.phar on line 2
PHP Warning: finfo_open(/tmp/test/test.phar/test.magic): failed to open
stream: No such file or directory in /tmp/test/test.phar on line 2
Warning: finfo_open(/tmp/test/test.phar/test.magic): failed to open
stream: No such file or directory in /tmp/test/test.phar on line 2
PHP Notice: finfo_open(): Warning: using regular magic file
`/tmp/test/test.phar/test.magic' in /tmp/test/test.phar on line 2
Notice: finfo_open(): Warning: using regular magic file
`/tmp/test/test.phar/test.magic' in /tmp/test/test.phar on line 2
PHP Warning: finfo_open(/tmp/test/test.phar/test.magic): failed to open
stream: No such file or directory in /tmp/test/test.phar on line 2
Warning: finfo_open(/tmp/test/test.phar/test.magic): failed to open
stream: No such file or directory in /tmp/test/test.phar on line 2
PHP Warning: finfo_open(): Failed to load magic database at
'/tmp/test/phar:/tmp/test/test.phar/test.magic'. in /tmp/test/test.phar
on line 2
Warning: finfo_open(): Failed to load magic database at
'/tmp/test/phar:/tmp/test/test.phar/test.magic'. in /tmp/test/test.phar
on line 2
--
Edit bug report at https://bugs.php.net/bug.php?id=67556&edit=1
--