Bug #67556 [NEW]: finfo_open does not work with phar:// magic files

From: Date: Wed, 02 Jul 2014 20:01:48 +0000
Subject: Bug #67556 [NEW]: finfo_open does not work with phar:// magic files
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186433@lists.php.net to get a copy of this message
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
-- 



Thread (1 message)

  • cweiske@php.net
« previous php.bugs (#186433) next »