diff options
-rw-r--r-- | ext/date/php_date.c | 4 | ||||
-rw-r--r-- | ext/date/tests/date_sunrise_and_sunset_error.phpt | 21 | ||||
-rw-r--r-- | ext/fileinfo/fileinfo.c | 8 | ||||
-rw-r--r-- | ext/fileinfo/tests/bug61964-mb.phpt | 2 | ||||
-rw-r--r-- | ext/fileinfo/tests/bug61964.phpt | 2 | ||||
-rw-r--r-- | ext/fileinfo/tests/bug68996.phpt | 2 | ||||
-rw-r--r-- | ext/fileinfo/tests/bug71527-mb.phpt | 2 | ||||
-rw-r--r-- | ext/fileinfo/tests/bug71527.phpt | 2 | ||||
-rw-r--r-- | ext/fileinfo/tests/finfo_open_001.phpt | 6 | ||||
-rw-r--r-- | ext/fileinfo/tests/finfo_open_error.phpt | 2 | ||||
-rw-r--r-- | ext/mysqli/mysqli.c | 6 | ||||
-rw-r--r-- | ext/mysqli/mysqli_api.c | 7 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_commit_oo.phpt | 25 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_fetch_array.phpt | 24 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_fetch_array_oo.phpt | 24 | ||||
-rw-r--r-- | ext/mysqli/tests/mysqli_stmt_bind_param.phpt | 18 | ||||
-rw-r--r-- | ext/mysqlnd/mysqlnd_connection.c | 2 | ||||
-rw-r--r-- | ext/xsl/xsltprocessor.c | 7 |
18 files changed, 92 insertions, 72 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 88431a22ea..8c0f5a62b1 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -4501,8 +4501,8 @@ static void php_do_date_sunrise_sunset(INTERNAL_FUNCTION_PARAMETERS, int calc_su retformat != SUNFUNCS_RET_STRING && retformat != SUNFUNCS_RET_DOUBLE) { - php_error_docref(NULL, E_WARNING, "Wrong return format given, pick one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING or SUNFUNCS_RET_DOUBLE"); - RETURN_FALSE; + zend_argument_value_error(2, "must be one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, or SUNFUNCS_RET_DOUBLE"); + RETURN_THROWS(); } altitude = 90 - zenith; diff --git a/ext/date/tests/date_sunrise_and_sunset_error.phpt b/ext/date/tests/date_sunrise_and_sunset_error.phpt new file mode 100644 index 0000000000..4505439017 --- /dev/null +++ b/ext/date/tests/date_sunrise_and_sunset_error.phpt @@ -0,0 +1,21 @@ +--TEST-- +Test error condition of date_sunrise() and date_sunset() +--FILE-- +<?php + +try { + date_sunrise(time(), 3); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +try { + date_sunset(time(), 4); +} catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; +} + +?> +--EXPECT-- +date_sunrise(): Argument #2 ($returnFormat) must be one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, or SUNFUNCS_RET_DOUBLE +date_sunset(): Argument #2 ($returnFormat) must be one of SUNFUNCS_RET_TIMESTAMP, SUNFUNCS_RET_STRING, or SUNFUNCS_RET_DOUBLE diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c index 2538171f25..1b26736ad0 100644 --- a/ext/fileinfo/fileinfo.c +++ b/ext/fileinfo/fileinfo.c @@ -71,8 +71,8 @@ static inline finfo_object *php_finfo_fetch_object(zend_object *obj) { finfo_object *obj = Z_FINFO_P(object); \ finfo = obj->ptr; \ if (!finfo) { \ - php_error_docref(NULL, E_WARNING, "The invalid fileinfo object."); \ - RETURN_FALSE; \ + zend_throw_error(NULL, "Invalid finfo object"); \ + RETURN_THROWS(); \ } \ } @@ -270,7 +270,7 @@ PHP_FUNCTION(finfo_open) } if (magic_load(finfo->magic, file) == -1) { - php_error_docref(NULL, E_WARNING, "Failed to load magic database at '%s'.", file); + php_error_docref(NULL, E_WARNING, "Failed to load magic database at \"%s\"", file); magic_close(finfo->magic); efree(finfo); if (object) { @@ -382,7 +382,7 @@ static void _php_finfo_get_type(INTERNAL_FUNCTION_PARAMETERS, int mode, int mime magic = magic_open(MAGIC_MIME_TYPE); if (magic_load(magic, NULL) == -1) { - php_error_docref(NULL, E_WARNING, "Failed to load magic database."); + php_error_docref(NULL, E_WARNING, "Failed to load magic database"); goto common; } } else if (object) { diff --git a/ext/fileinfo/tests/bug61964-mb.phpt b/ext/fileinfo/tests/bug61964-mb.phpt index 9187393554..1142ad7eed 100644 --- a/ext/fileinfo/tests/bug61964-mb.phpt +++ b/ext/fileinfo/tests/bug61964-mb.phpt @@ -58,5 +58,5 @@ Warning: finfo_open(): offset `a' invalid in %sbug61964-mb.php on line %d Warning: finfo_open(): offset `b' invalid in %sbug61964-mb.php on line %d -Warning: finfo_open(): Failed to load magic database at '%sbug61964-mb'. in %sbug61964-mb.php on line %d +Warning: finfo_open(): Failed to load magic database at "%sbug61964-mb" in %sbug61964-mb.php on line %d DONE: testing dir with files diff --git a/ext/fileinfo/tests/bug61964.phpt b/ext/fileinfo/tests/bug61964.phpt index 24cf3bec8c..ecb12fe752 100644 --- a/ext/fileinfo/tests/bug61964.phpt +++ b/ext/fileinfo/tests/bug61964.phpt @@ -58,5 +58,5 @@ Warning: finfo_open(): offset `a' invalid in %sbug61964.php on line %d Warning: finfo_open(): offset `b' invalid in %sbug61964.php on line %d -Warning: finfo_open(): Failed to load magic database at '%sbug61964'. in %sbug61964.php on line %d +Warning: finfo_open(): Failed to load magic database at "%sbug61964" in %sbug61964.php on line %d DONE: testing dir with files diff --git a/ext/fileinfo/tests/bug68996.phpt b/ext/fileinfo/tests/bug68996.phpt index aabd2670bd..2535f5e455 100644 --- a/ext/fileinfo/tests/bug68996.phpt +++ b/ext/fileinfo/tests/bug68996.phpt @@ -14,4 +14,4 @@ finfo_open(FILEINFO_MIME_TYPE, "\xfc\x63"); <br /> <b>Warning</b>: finfo_open(%s�c): Failed to open stream: No such file or directory in <b>%sbug68996.php</b> on line <b>%d</b><br /> <br /> -<b>Warning</b>: finfo_open(): Failed to load magic database at '%s�c'. in <b>%sbug68996.php</b> on line <b>%d</b><br /> +<b>Warning</b>: finfo_open(): Failed to load magic database at "%s�c" in <b>%s</b> on line <b>%d</b><br /> diff --git a/ext/fileinfo/tests/bug71527-mb.phpt b/ext/fileinfo/tests/bug71527-mb.phpt index ea32a8122a..0240ce3303 100644 --- a/ext/fileinfo/tests/bug71527-mb.phpt +++ b/ext/fileinfo/tests/bug71527-mb.phpt @@ -12,5 +12,5 @@ USE_ZEND_ALLOC=0 var_dump($finfo); ?> --EXPECTF-- -Warning: finfo_open(): Failed to load magic database at '%sbug71527私はガラスを食べられます.magic'. in %sbug71527-mb.php on line %d +Warning: finfo_open(): Failed to load magic database at "%sbug71527私はガラスを食べられます.magic" in %sbug71527-mb.php on line %d bool(false) diff --git a/ext/fileinfo/tests/bug71527.phpt b/ext/fileinfo/tests/bug71527.phpt index 9a00c4f32b..3a536266fc 100644 --- a/ext/fileinfo/tests/bug71527.phpt +++ b/ext/fileinfo/tests/bug71527.phpt @@ -12,5 +12,5 @@ USE_ZEND_ALLOC=0 var_dump($finfo); ?> --EXPECTF-- -Warning: finfo_open(): Failed to load magic database at '%sbug71527.magic'. in %sbug71527.php on line %d +Warning: finfo_open(): Failed to load magic database at "%sbug71527.magic" in %sbug71527.php on line %d bool(false) diff --git a/ext/fileinfo/tests/finfo_open_001.phpt b/ext/fileinfo/tests/finfo_open_001.phpt index b2285dd35c..ef36bc21f0 100644 --- a/ext/fileinfo/tests/finfo_open_001.phpt +++ b/ext/fileinfo/tests/finfo_open_001.phpt @@ -27,19 +27,19 @@ Warning: finfo_open(%s123): Failed to open stream: No such file or directory in Warning: finfo_open(%s123): Failed to open stream: No such file or directory in %s on line %d -Warning: finfo_open(): Failed to load magic database at '%s123'. in %s on line %d +Warning: finfo_open(): Failed to load magic database at "%s123" in %s on line %d bool(false) Warning: finfo_open(%s1): Failed to open stream: No such file or directory in %s on line %d Warning: finfo_open(%s1): Failed to open stream: No such file or directory in %s on line %d -Warning: finfo_open(): Failed to load magic database at '%s1'. in %s on line %d +Warning: finfo_open(): Failed to load magic database at "%s1" in %s on line %d bool(false) Warning: finfo_open(%sinexistent): Failed to open stream: No such file or directory in %s on line %d Warning: finfo_open(%sinexistent): Failed to open stream: No such file or directory in %s on line %d -Warning: finfo_open(): Failed to load magic database at '%sinexistent'. in %s on line %d +Warning: finfo_open(): Failed to load magic database at "%sinexistent" in %s on line %d bool(false) diff --git a/ext/fileinfo/tests/finfo_open_error.phpt b/ext/fileinfo/tests/finfo_open_error.phpt index b079de682d..881c26f664 100644 --- a/ext/fileinfo/tests/finfo_open_error.phpt +++ b/ext/fileinfo/tests/finfo_open_error.phpt @@ -31,7 +31,7 @@ Warning: finfo_open(%sfoobarfile): Failed to open stream: No such file or direct Warning: finfo_open(%sfoobarfile): Failed to open stream: No such file or directory in %sfinfo_open_error.php on line %d -Warning: finfo_open(): Failed to load magic database at '%sfoobarfile'. in %sfinfo_open_error.php on line %d +Warning: finfo_open(): Failed to load magic database at "%sfoobarfile" in %sfinfo_open_error.php on line %d bool(false) Warning: finfo_open(): using regular magic file `%smagic' in %sfinfo_open_error.php on line %d diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index 9eb1885ea6..05ffffa926 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -47,6 +47,8 @@ static PHP_GINIT_FUNCTION(mysqli); } \ } +#define ERROR_ARG_POS(arg_num) (getThis() ? (arg_num-1) : (arg_num)) + static HashTable classes; static zend_object_handlers mysqli_object_handlers; static zend_object_handlers mysqli_object_driver_handlers; @@ -1168,8 +1170,8 @@ void php_mysqli_fetch_into_hash(INTERNAL_FUNCTION_PARAMETERS, int override_flags MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); if (fetchtype < MYSQLI_ASSOC || fetchtype > MYSQLI_BOTH) { - php_error_docref(NULL, E_WARNING, "The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH"); - RETURN_FALSE; + zend_argument_value_error(ERROR_ARG_POS(2), "must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH"); + RETURN_THROWS(); } php_mysqli_fetch_into_hash_aux(return_value, result, fetchtype); diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c index 928031f82e..9191580942 100644 --- a/ext/mysqli/mysqli_api.c +++ b/ext/mysqli/mysqli_api.c @@ -93,7 +93,7 @@ mysqli_escape_string_for_tx_name_in_comment(const char * const name) { *p_copy++ = v; } else if (warned == FALSE) { - php_error_docref(NULL, E_WARNING, "Transaction name truncated. Must be only [0-9A-Za-z\\-_=]+"); + php_error_docref(NULL, E_WARNING, "Transaction name has been truncated, since it can only contain the A-Z, a-z, 0-9, \"\\\", \"-\", \"_\", and \"=\" characters"); warned = TRUE; } ++p_orig; @@ -230,7 +230,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a break; default: - php_error_docref(NULL, E_WARNING, "Undefined fieldtype %c (parameter %d)", types[ofs], i + num_extra_args + 1); + zend_argument_value_error(num_extra_args, "must only contain the \"b\", \"d\", \"i\", \"s\" type specifiers"); rc = 1; goto end_1; } @@ -292,8 +292,7 @@ int mysqli_stmt_bind_param_do_bind(MY_STMT *stmt, unsigned int num_vars, zval *a type = MYSQL_TYPE_VAR_STRING; break; default: - /* We count parameters from 1 */ - php_error_docref(NULL, E_WARNING, "Undefined fieldtype %c (parameter %d)", types[i], i + num_extra_args + 1); + zend_argument_value_error(num_extra_args, "must only contain the \"b\", \"d\", \"i\", \"s\" type specifiers"); ret = FAIL; mysqlnd_stmt_free_param_bind(stmt->stmt, params); goto end; diff --git a/ext/mysqli/tests/mysqli_commit_oo.phpt b/ext/mysqli/tests/mysqli_commit_oo.phpt index 6377fdf5a9..e4cfbe4794 100644 --- a/ext/mysqli/tests/mysqli_commit_oo.phpt +++ b/ext/mysqli/tests/mysqli_commit_oo.phpt @@ -76,15 +76,13 @@ if (!have_innodb($link)) if (!$mysqli->commit(0 , "tx_name0123")) { printf("[012] [%d] %s\n", $mysqli->errno, $mysqli->error); } - if (!$mysqli->commit(0 , "*/ nonsense")) { - printf("[013] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - if (!$mysqli->commit(0 , "tx_name ulf вендел")) { - printf("[014] [%d] %s\n", $mysqli->errno, $mysqli->error); - } - if (!$mysqli->commit(0 , "tx_name \t\n\r\b")) { - printf("[015] [%d] %s\n", $mysqli->errno, $mysqli->error); - } + + var_dump($mysqli->commit(0 , "*/ nonsense")); + + var_dump($mysqli->commit(0 , "tx_name ulf вендел")); + + var_dump($mysqli->commit(0 , "tx_name \t\n\r\b")); + if (!$mysqli->commit(MYSQLI_TRANS_COR_AND_CHAIN | MYSQLI_TRANS_COR_NO_RELEASE , "tx_name")) { printf("[016] [%d] %s\n", $mysqli->errno, $mysqli->error); } @@ -105,10 +103,13 @@ if (!have_innodb($link)) --EXPECTF-- mysqli object is not fully initialized -Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d +Warning: mysqli::commit(): Transaction name has been truncated, since it can only contain the A-Z, a-z, 0-9, "\", "-", "_", and "=" characters in %s on line %d +bool(true) -Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d +Warning: mysqli::commit(): Transaction name has been truncated, since it can only contain the A-Z, a-z, 0-9, "\", "-", "_", and "=" characters in %s on line %d +bool(true) -Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d +Warning: mysqli::commit(): Transaction name has been truncated, since it can only contain the A-Z, a-z, 0-9, "\", "-", "_", and "=" characters in %s on line %d +bool(true) my_mysqli object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_array.phpt b/ext/mysqli/tests/mysqli_fetch_array.phpt index c2046f1821..044ed2de0c 100644 --- a/ext/mysqli/tests/mysqli_fetch_array.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array.phpt @@ -48,15 +48,17 @@ require_once('skipifconnectfailure.inc'); $illegal_mode = mt_rand(-10000, 10000); } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. - $tmp = mysqli_fetch_array($res, $illegal_mode); - if (false !== $tmp) - printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + try { + mysqli_fetch_array($res, $illegal_mode); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } - $tmp = mysqli_fetch_array($res, $illegal_mode); - if (false !== $tmp) - printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link)); + try { + mysqli_fetch_array($res, $illegal_mode); + } catch (ValueError $exception) { + echo $exception->getMessage() . "\n"; + } mysqli_free_result($res); @@ -357,9 +359,7 @@ array(11) { ["e"]=> string(1) "1" } - -Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d - -Warning: mysqli_fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d +mysqli_fetch_array(): Argument #2 ($fetchtype) must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH +mysqli_fetch_array(): Argument #2 ($fetchtype) must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt index 6bf2b0f4c0..599b9d0c94 100644 --- a/ext/mysqli/tests/mysqli_fetch_array_oo.phpt +++ b/ext/mysqli/tests/mysqli_fetch_array_oo.phpt @@ -55,15 +55,17 @@ require_once('skipifconnectfailure.inc'); $illegal_mode = mt_rand(-10000, 10000); } while (in_array($illegal_mode, array(MYSQLI_ASSOC, MYSQLI_NUM, MYSQLI_BOTH))); // NOTE: for BC reasons with ext/mysql, ext/mysqli accepts invalid result modes. - $tmp = $res->fetch_array($illegal_mode); - if (false !== $tmp) - printf("[013] Expecting boolean/false although, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + try { + $res->fetch_array($illegal_mode); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } - $tmp = $res->fetch_array($illegal_mode); - if (false !== $tmp) - printf("[014] Expecting boolean/false, got %s/%s. [%d] %s\n", - gettype($tmp), $tmp, $mysqli->errno, $mysqli->error); + try { + $res->fetch_array($illegal_mode); + } catch (Error $exception) { + echo $exception->getMessage() . "\n"; + } $res->free_result(); @@ -353,9 +355,7 @@ array(11) { ["e"]=> string(1) "1" } - -Warning: mysqli_result::fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d - -Warning: mysqli_result::fetch_array(): The result type should be either MYSQLI_NUM, MYSQLI_ASSOC or MYSQLI_BOTH in %s on line %d +mysqli_result::fetch_array(): Argument #1 ($result_type) must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH +mysqli_result::fetch_array(): Argument #1 ($result_type) must be one of MYSQLI_NUM, MYSQLI_ASSOC, or MYSQLI_BOTH mysqli_result object is already closed done! diff --git a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt index 237b722646..f3f11511ca 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_param.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_param.phpt @@ -83,16 +83,14 @@ require_once('skipifconnectfailure.inc'); } try { - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "aa", $id, $label))) - printf("[006] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - } catch (\ArgumentCountError $e) { + mysqli_stmt_bind_param($stmt, "aa", $id, $label); + } catch (ValueError $e) { echo $e->getMessage() . \PHP_EOL; } try { - if (!false === ($tmp = mysqli_stmt_bind_param($stmt, "ia", $id, $label))) - printf("[007] Expecting boolean/false, got %s/%s\n", gettype($tmp), $tmp); - } catch (\ArgumentCountError $e) { + mysqli_stmt_bind_param($stmt, "ia", $id, $label); + } catch (ValueError $e) { echo $e->getMessage() . \PHP_EOL; } @@ -414,7 +412,7 @@ require_once('skipifconnectfailure.inc'); <?php require_once("clean_table.inc"); ?> ---EXPECTF-- +--EXPECT-- The number of variables must match the number of parameters in the prepared statement mysqli_stmt_bind_param(): Argument #2 ($types) cannot be empty The number of elements in the type definition string must match the number of bind variables @@ -422,8 +420,6 @@ The number of variables must match the number of parameters in the prepared stat The number of elements in the type definition string must match the number of bind variables The number of variables must match the number of parameters in the prepared statement The number of elements in the type definition string must match the number of bind variables - -Warning: mysqli_stmt_bind_param(): Undefined fieldtype a (parameter 3) in %s on line %d - -Warning: mysqli_stmt_bind_param(): Undefined fieldtype a (parameter 4) in %s on line %d +mysqli_stmt_bind_param(): Argument #2 ($types) must only contain the "b", "d", "i", "s" type specifiers +mysqli_stmt_bind_param(): Argument #2 ($types) must only contain the "b", "d", "i", "s" type specifiers done! diff --git a/ext/mysqlnd/mysqlnd_connection.c b/ext/mysqlnd/mysqlnd_connection.c index 5915e1266e..35cc3f55fc 100644 --- a/ext/mysqlnd/mysqlnd_connection.c +++ b/ext/mysqlnd/mysqlnd_connection.c @@ -2054,7 +2054,7 @@ mysqlnd_escape_string_for_tx_name_in_comment(const char * const name) { *p_copy++ = v; } else if (warned == FALSE) { - php_error_docref(NULL, E_WARNING, "Transaction name truncated. Must be only [0-9A-Za-z\\-_=]+"); + php_error_docref(NULL, E_WARNING, "Transaction name has been truncated, since it can only contain the A-Z, a-z, 0-9, \"\\\", \"-\", \"_\", and \"=\" characters"); warned = TRUE; } ++p_orig; diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index deac062bfa..d900d95103 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -573,9 +573,10 @@ PHP_METHOD(XSLTProcessor, transformToDoc) ce = zend_lookup_class(ret_class); if (ce == NULL || !instanceof_function(ce, curce)) { xmlFreeDoc(newdocp); - php_error_docref(NULL, E_WARNING, - "Expecting class compatible with %s, '%s' given", ZSTR_VAL(curclass_name), ZSTR_VAL(ret_class)); - RETURN_FALSE; + zend_argument_type_error(2, "must be a class name compatible with %s, \"%s\" given", + ZSTR_VAL(curclass_name), ZSTR_VAL(ret_class) + ); + RETURN_THROWS(); } object_init_ex(return_value, ce); |