Skip to content

Commit ec13ba7

Browse files
committed
ext/standard/file: clarify fclose() warning
1 parent d1f033b commit ec13ba7

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

ext/spl/tests/bug81691.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ var_dump($obj->fgets());
1010

1111
?>
1212
--EXPECTF--
13-
Warning: fclose(): %d is not a valid stream resource in %s on line %d
13+
Warning: fclose(): cannot close the provided stream, as it must not be manually closed in %s on line %d
1414
string(6) "<?php
1515
"

ext/standard/file.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ PHPAPI PHP_FUNCTION(fclose)
757757
ZEND_PARSE_PARAMETERS_END();
758758

759759
if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) {
760-
php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " is not a valid stream resource", stream->res->handle);
760+
php_error_docref(NULL, E_WARNING, "cannot close the provided stream, as it must not be manually closed");
761761
RETURN_FALSE;
762762
}
763763

ext/standard/tests/filters/bug54350.phpt

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ fwrite($fd, "foo");
2222

2323
?>
2424
--EXPECTF--
25-
Warning: fclose(): %d is not a valid stream resource in %s on line %d
25+
Warning: fclose(): cannot close the provided stream, as it must not be manually closed in %s on line %d
2626
fclose(): Argument #1 ($stream) must be an open stream resource

ext/xmlwriter/tests/bug79029.phpt

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ okey
2626
@unlink("bug79029_3.txt");
2727
?>
2828
--EXPECTF--
29-
Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d
29+
Warning: fclose(): cannot close the provided stream, as it must not be manually closed in %sbug79029.php on line %d
3030

31-
Warning: fclose(): %d is not a valid stream resource in %sbug79029.php on line %d
31+
Warning: fclose(): cannot close the provided stream, as it must not be manually closed in %sbug79029.php on line %d
3232
okey

0 commit comments

Comments
 (0)