php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #67556 Document which parameters accept stream wrapper URLs
Submitted: 2014-07-02 20:01 UTC Modified: 2021-01-18 17:44 UTC
From: cweiske@php.net Assigned:
Status: Verified Package: *General Issues
PHP Version: 5.6.0RC1 OS: Ubuntu Linux 13.10
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-07-02 20:01 UTC] cweiske@php.net
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


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-21 11:11 UTC] cmb@php.net
To my knowledge, finfo_open() does not support any stream wrappers
at all.
 [2018-08-21 12:15 UTC] requinix@php.net
Yeah, doesn't look like libmagic has support for some sort of custom database. It wants filenames.
 [2021-01-18 17:44 UTC] cmb@php.net
-Summary: finfo_open does not work with phar:// magic files +Summary: Document which parameters accept stream wrapper URLs -Status: Open +Status: Verified -Type: Bug +Type: Documentation Problem -Package: PHAR related +Package: *General Issues
 [2021-01-18 17:44 UTC] cmb@php.net
Makes no sense to leave this open as bug.  I think we should
document all parameters which accept stream wrapper URLs.  The
manual is currently pretty sloppy about that.

In any way, this is not a Phar issue.
 [2023-05-08 12:25 UTC] fitnesscaredoctor at gmail dot com
Fitness Care Doctor are sharing latest news about fitness, health, medicine, docotor, weight loss, treatment etc. More info to visit: (https://fitnesscaredoctor.com)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 02:01:28 2024 UTC