Skip to content

Commit 98bf240

Browse files
committed
Partial revert
1 parent b1b68c0 commit 98bf240

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

ext/bz2/bz2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,8 +374,8 @@ static PHP_FUNCTION(bzopen)
374374
/* If it's not a resource its a string containing the filename to open */
375375
if (Z_TYPE_P(file) == IS_STRING) {
376376
if (Z_STRLEN_P(file) == 0) {
377-
zend_value_error("filename cannot be empty");
378-
return;
377+
php_error_docref(NULL, E_WARNING, "filename cannot be empty");
378+
RETURN_FALSE;
379379
}
380380

381381
if (CHECK_ZVAL_NULL_PATH(file)) {
@@ -569,7 +569,7 @@ static PHP_FUNCTION(bzdecompress)
569569
size = (bzs.total_out_hi32 * (unsigned int) -1) + bzs.total_out_lo32;
570570
#if !ZEND_ENABLE_ZVAL_LONG64
571571
if (UNEXPECTED(size > SIZE_MAX)) {
572-
zend_value_error("Decompressed size too big, max is %zd", SIZE_MAX);
572+
php_error_docref(NULL, E_WARNING, "Decompressed size too big, max is %zd", SIZE_MAX);
573573
zend_string_efree(dest);
574574
return;
575575
} else

ext/bz2/tests/001.phpt

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,8 @@ try {
1111
echo $e->getMessage() . \PHP_EOL;
1212
}
1313

14-
try {
15-
var_dump(bzopen("", "r"));
16-
} catch (\ValueError $e) {
17-
echo $e->getMessage() . \PHP_EOL;
18-
}
19-
20-
try {
21-
var_dump(bzopen("", "w"));
22-
} catch (\ValueError $e) {
23-
echo $e->getMessage() . \PHP_EOL;
24-
}
14+
var_dump(bzopen("", "r"));
15+
var_dump(bzopen("", "w"));
2516

2617
try {
2718
var_dump(bzopen("", "x"));
@@ -47,8 +38,12 @@ var_dump(bzopen($fp, "r"));
4738
?>
4839
--EXPECTF--
4940
'' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
50-
filename cannot be empty
51-
filename cannot be empty
41+
42+
Warning: bzopen(): filename cannot be empty in %s on line %d
43+
bool(false)
44+
45+
Warning: bzopen(): filename cannot be empty in %s on line %d
46+
bool(false)
5247
'x' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
5348
'rw' is not a valid mode for bzopen(). Only 'w' and 'r' are supported.
5449

0 commit comments

Comments
 (0)