ext/standard/file: clarify fclose() warning

This commit is contained in:
Gina Peter Banyard 2025-03-15 17:27:35 +00:00
parent 556e4d9008
commit fec4f7f389
4 changed files with 5 additions and 5 deletions

View file

@ -10,6 +10,6 @@ var_dump($obj->fgets());
?>
--EXPECTF--
Warning: fclose(): %d is not a valid stream resource in %s on line %d
Warning: fclose(): cannot close the provided stream, as it must not be manually closed in %s on line %d
string(6) "<?php
"

View file

@ -757,7 +757,7 @@ PHPAPI PHP_FUNCTION(fclose)
ZEND_PARSE_PARAMETERS_END();
if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) {
php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " is not a valid stream resource", stream->res->handle);
php_error_docref(NULL, E_WARNING, "cannot close the provided stream, as it must not be manually closed");
RETURN_FALSE;
}

View file

@ -22,5 +22,5 @@ fwrite($fd, "foo");
?>
--EXPECTF--
Warning: fclose(): %d is not a valid stream resource in %s on line %d
Warning: fclose(): cannot close the provided stream, as it must not be manually closed in %s on line %d
fclose(): Argument #1 ($stream) must be an open stream resource

View file

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