Bug #79467 [Opn]: file_put_contents can't create file with data:// wrappers

From: Date: Sat, 11 Apr 2020 15:22:04 +0000
Subject: Bug #79467 [Opn]: file_put_contents can't create file with data:// wrappers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-226537@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79467&edit=1 ID: 79467 Updated by: peehaa@php.net Reported by: j7ur8 at qq dot com Summary: file_put_contents can't create file with data:// wrappers Status: Open Type: Bug Package: Streams related Operating System: windows Linux PHP Version: 7.4.4 Block user comment: N Private report: N New Comment: According to the docs https://www.php.net/manual/en/wrappers.data.php#refsect1-wrappers.data-options writing is not supported so seems to be working as designed. If anything it shouldn't say it wrote 4 bytes instead. Previous Comments: ------------------------------------------------------------------------ [2020-04-11 15:11:31] j7ur8 at qq dot com Description: ------------ file_put_contents ( string $filename , mixed $data [, int $flags = 0 [, resource $context ]] ) : int 1. above is the function details 2. And when the params of filename in file_put_contents starts with data:// , php will execute it successful, but create a file. Test script: --------------- <?php echo file_put_contents('data://text/plain,cccc', 'data'); ?> Expected result: ---------------- 4 ; and create a file names 'ccc' Actual result: -------------- 4; and do not create any file. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79467&edit=1

« previous php.bugs (#226537) next »