|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull Requests
Pull requests: 
 HistoryAllCommentsChangesGit/SVN commits              [2017-06-08 21:41 UTC] kelunik@php.net
  [2018-01-17 11:47 UTC] nikic@php.net
  [2018-01-17 11:47 UTC] nikic@php.net
 
-Status: Open
+Status: Closed
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 07:00:01 2025 UTC | 
Description: ------------ The only way to set *no context* to fopen() is to not set the 4th parameter. This should be changed to accept NULL as 4th parameter, leading to *no context*. Why? 1) consistency. At least three related functions accepts NULL 2) enables to set the context dynamically, eg avoiding if ($context) fopen (.., $context) else fopen (..) 3) not a BC break, unless you include previously broken code Test script: --------------- file_put_contents ('/tmp/foo', 'bar', 0, NULL); file_get_contents ('/tmp/foo', false, NULL); file ('/tmp/foo', 0, NULL); fopen ('/tmp/foo', 'r', false, NULL); Expected result: ---------------- No warning Actual result: -------------- "PHP Warning: fopen() expects parameter 4 to be resource, null given"