mirror of
https://github.com/php/php-src.git
synced 2024-11-28 12:26:37 +08:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #76735: Incorrect message in fopen on invalid mode
This commit is contained in:
commit
a89ac98f15
1
NEWS
1
NEWS
@ -25,6 +25,7 @@ PHP NEWS
|
||||
- Standard:
|
||||
. Fixed bug #80114 (parse_url does not accept URLs with port 0). (cmb, twosee)
|
||||
. Fixed bug #76943 (Inconsistent stream_wrapper_restore() errors). (cmb)
|
||||
. Fixed bug #76735 (Incorrect message in fopen on invalid mode). (cmb)
|
||||
|
||||
01 Oct 2020, PHP 7.4.11
|
||||
|
||||
|
@ -83,12 +83,12 @@ bool(false)
|
||||
resource(%d) of type (stream)
|
||||
resource(%d) of type (stream)
|
||||
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
|
||||
|
||||
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
|
||||
bool(false)
|
||||
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: Bad file %s in %s on line %d
|
||||
Warning: fopen(bz_open_002.txt): failed to open stream: `br' is not a valid mode for fopen in %s on line %d
|
||||
|
||||
Warning: bzopen(): first parameter has to be string or file-resource in %s on line %d
|
||||
bool(false)
|
||||
|
8
ext/standard/tests/file/bug76735.phpt
Normal file
8
ext/standard/tests/file/bug76735.phpt
Normal file
@ -0,0 +1,8 @@
|
||||
--TEST--
|
||||
Bug #76735 (Incorrect message in fopen on invalid mode)
|
||||
--FILE--
|
||||
<?php
|
||||
fopen(__FILE__, 'Q');
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: fopen(%s): failed to open stream: `Q' is not a valid mode for fopen in %s on line %d
|
@ -1047,9 +1047,7 @@ PHPAPI php_stream *_php_stream_fopen(const char *filename, const char *mode, zen
|
||||
char *persistent_id = NULL;
|
||||
|
||||
if (FAILURE == php_stream_parse_fopen_modes(mode, &open_flags)) {
|
||||
if (options & REPORT_ERRORS) {
|
||||
php_error_docref(NULL, E_WARNING, "`%s' is not a valid mode for fopen", mode);
|
||||
}
|
||||
php_stream_wrapper_log_error(&php_plain_files_wrapper, options, "`%s' is not a valid mode for fopen", mode);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user