Doc #67556 [Com]: Document which parameters accept stream wrapper URLs

[email protected] ("fitnesscaredoctor at gmail dot com") Mon, 08 May 2023 12:25:23 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=67556&edit=1

 ID:                 67556
 Comment by:         fitnesscaredoctor at gmail dot com
 Reported by:        [email protected]
 Summary:            Document which parameters accept stream wrapper URLs
 Status:             Verified
 Type:               Documentation Problem
 Package:            *General Issues
 Operating System:   Ubuntu Linux 13.10
 PHP Version:        5.6.0RC1
 Block user comment: N
 Private report:     N

 New Comment:

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


Previous Comments:
------------------------------------------------------------------------
[2021-01-18 17:44:20] [email protected]

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.

------------------------------------------------------------------------
[2018-08-21 12:15:33] [email protected]

Yeah, doesn't look like libmagic has support for some sort of custom database. It wants filenames.

------------------------------------------------------------------------
[2018-08-21 11:11:27] [email protected]

To my knowledge, finfo_open() does not support any stream wrappers
at all.

------------------------------------------------------------------------
[2014-07-02 20:01:48] [email protected]

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 this bug report at https://bugs.php.net/bug.php?id=67556&edit=1