Doc #47336 [Com]: data: stream restricted by allow_url_fopen
Edit report at https://bugs.php.net/bug.php?id=47336&edit=1
ID: 47336
Comment by: mlocati at gmail dot com
Reported by: evert at rooftopsolutions dot nl
Summary: data: stream restricted by allow_url_fopen
Status: Not a bug
Type: Documentation Problem
Package: Documentation problem
Operating System: *
PHP Version: 5.2.9RC1
Block user comment: N
Private report: N
New Comment:
This bug is still valid: reading https://www.php.net/manual/en/wrappers.data.php
it seems that the data:// stream wrapper is not affected by the allow_url_fopen INI value set to
false.
By the way, it seems that if allow_url_fopen is false, the stream wrapper is disabled.
I executed the command line described in the "Test script" section in the following
environments, and they all fail (they report the "data:// wrapper is disabled" warning):
- PHP 7.2.24 on Ubuntu 18.04.3
- PHP 7.4.0 on Windows 10 1909
- PHP 7.3.12 on Windows 10 1909
- PHP 7.2.25 on Windows 10 1909
- PHP 7.1.33 on Windows 10 1909
- PHP 7.0.33 on Windows 10 1909
- PHP 5.6.40 on Windows 10 1909
- PHP 5.5.38 on Windows 10 1909
- PHP 5.4.45 on Windows 10 1909
- PHP 5.3.29 on Windows 10 1909
- PHP 5.2.17 on Windows 10 1909
Is this a documentation issue? Or the manual describes the wanted behavior but the implementation is
wrong?
IMHO what's described in the documentation is to be preferred...
# Test script:
php -n -d allow_url_fopen=0 -r "echo in_array('data', stream_get_wrappers()) ?
file_get_contents('data://text/plain,test') : 'not available';"
# Expected result:
test
# Actual result:
Warning: file_get_contents(): data:// wrapper is disabled in the server configuration by
allow_url_fopen=0 in Command line code on line 1
Previous Comments:
------------------------------------------------------------------------
[2013-03-11 09:31:02] stoller at leonex dot de
This bug still exists. I am calling
$res = fopen('data://text/plain;base64,' . base64_encode($value), 'r');
And getting this error log: PHP Warning: fopen(): data:// wrapper is disabled in the server
configuration by allow_url_fopen=0 in
/var/www/htdocs/src/Acme/Component/Doctrine/DBAL/Types/Mediumblob.php on line 27
$ php -v
PHP 5.3.3-7+squeeze15 with Suhosin-Patch (cli) (built: Mar 4 2013 13:11:17)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
------------------------------------------------------------------------
[2009-11-20 10:13:10] evert at rooftopsolutions dot nl
Dear vrana,
This is incorrect. Either the documentation or the behaviour is broken.
The documentation states:
Restricted by allow_url_fopen No
------------------------------------------------------------------------
[2009-11-20 10:07:28] vrana@php.net
Documented at http://www.php.net/manual/en/wrappers.data.php
------------------------------------------------------------------------
[2009-02-07 22:33:47] evert at rooftopsolutions dot nl
Description:
------------
Looks like data: streams are restricted by allow_url_fopen, but the documentation seems to state
otherwise..
http://ca2.php.net/manual/en/wrappers.data.php
Reproduce code:
---------------
php -d allow_url_fopen=0 -r "fopen('data://text/plain,hi','r');"
Expected result:
----------------
nothing
Actual result:
--------------
Warning: fopen(): URL file-access is disabled in the server configuration in Command line code on
line 1
Call Stack:
0.0002 47712 1. {main}() Command line code:0
0.0003 47792 2. fopen() Command line code:1
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=47336&edit=1
Thread (5 messages)