close_stream = 0;
} else if (Z_TYPE_P(to_zval) == IS_STRING) {
if (CHECK_ZVAL_NULL_PATH(to_zval)) {
- php_error_docref(NULL, E_WARNING, "Invalid 2nd parameter, filename must not contain null bytes");
- RETURN_FALSE;
+ zend_type_error("Invalid 2nd parameter, filename must not contain null bytes");
+ return;
}
stream = php_stream_open_wrapper(Z_STRVAL_P(to_zval), "wb", REPORT_ERRORS|IGNORE_PATH|IGNORE_URL_WIN, NULL);
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagebmp($image, "./foo\0bar"));
+try {
+ imagebmp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
-===DONE===
---EXPECTF--
-Warning: imagebmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
-===DONE===
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagegif($image, "./foo\0bar"));
+try {
+ imagegif($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagegif(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagejpeg($image, "./foo\0bar"));
+try {
+ imagejpeg($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagejpeg(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagepng($image, "./foo\0bar"));
+try {
+ imagepng($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
--EXPECTF--
-Warning: imagepng(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+Invalid 2nd parameter, filename must not contain null bytes
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagewbmp($image, "./foo\0bar"));
+try {
+ imagewbmp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagewbmp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
-var_dump(imagewebp($image, "./foo\0bar"));
+try {
+ imagewebp($image, "./foo\0bar");
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
?>
---EXPECTF--
-Warning: imagewebp(): Invalid 2nd parameter, filename must not contain null bytes in %s on line %d
-bool(false)
+--EXPECT--
+Invalid 2nd parameter, filename must not contain null bytes