diff options
author | Aaron Piotrowski <aaron@trowski.com> | 2016-06-11 12:07:28 -0500 |
---|---|---|
committer | Aaron Piotrowski <aaron@trowski.com> | 2016-06-13 09:02:17 -0500 |
commit | 771e5cc24716304dd2bf8cbd8aec11d465965d0a (patch) | |
tree | cf85742ca6a5810f284f62902f9dc7efc756a663 /ext | |
parent | e3c681aa5cc71122a8d2fae42e6513fc413ccac8 (diff) | |
download | php-git-771e5cc24716304dd2bf8cbd8aec11d465965d0a.tar.gz |
Replace zend_ce_error with NULL and replace more E_ERROR with thrown Error
Diffstat (limited to 'ext')
30 files changed, 101 insertions, 65 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index d8e6ba6419..e76ca7f723 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -28,7 +28,6 @@ #include "ext/standard/php_math.h" #include "php_date.h" #include "zend_interfaces.h" -#include "zend_exceptions.h" #include "lib/timelib.h" #include <time.h> @@ -2786,7 +2785,7 @@ PHP_METHOD(DateTime, __set_state) php_date_instantiate(date_ce_date, return_value); dateobj = Z_PHPDATE_P(return_value); if (!php_date_initialize_from_hash(&dateobj, myht)) { - php_error(E_ERROR, "Invalid serialization data for DateTime object"); + zend_throw_error(NULL, "Invalid serialization data for DateTime object"); } } /* }}} */ @@ -2808,7 +2807,7 @@ PHP_METHOD(DateTimeImmutable, __set_state) php_date_instantiate(date_ce_immutable, return_value); dateobj = Z_PHPDATE_P(return_value); if (!php_date_initialize_from_hash(&dateobj, myht)) { - php_error(E_ERROR, "Invalid serialization data for DateTimeImmutable object"); + zend_throw_error(NULL, "Invalid serialization data for DateTimeImmutable object"); } } /* }}} */ @@ -2826,7 +2825,7 @@ PHP_METHOD(DateTime, __wakeup) myht = Z_OBJPROP_P(object); if (!php_date_initialize_from_hash(&dateobj, myht)) { - php_error(E_ERROR, "Invalid serialization data for DateTime object"); + zend_throw_error(NULL, "Invalid serialization data for DateTime object"); } } /* }}} */ @@ -3706,7 +3705,7 @@ PHP_METHOD(DateTimeZone, __set_state) php_date_instantiate(date_ce_timezone, return_value); tzobj = Z_PHPTIMEZONE_P(return_value); if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht) != SUCCESS) { - zend_throw_error(zend_ce_error, "Timezone initialization failed"); + zend_throw_error(NULL, "Timezone initialization failed"); zval_dtor(return_value); RETURN_FALSE; } @@ -3726,7 +3725,7 @@ PHP_METHOD(DateTimeZone, __wakeup) myht = Z_OBJPROP_P(object); if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht) != SUCCESS) { - zend_throw_error(zend_ce_error, "Timezone initialization failed"); + zend_throw_error(NULL, "Timezone initialization failed"); RETURN_FALSE; } } @@ -5007,7 +5006,7 @@ PHP_METHOD(DatePeriod, __set_state) object_init_ex(return_value, date_ce_period); period_obj = Z_PHPPERIOD_P(return_value); if (!php_date_period_initialize_from_hash(period_obj, myht)) { - php_error(E_ERROR, "Invalid serialization data for DatePeriod object"); + zend_throw_error(NULL, "Invalid serialization data for DatePeriod object"); } } /* }}} */ @@ -5025,7 +5024,7 @@ PHP_METHOD(DatePeriod, __wakeup) myht = Z_OBJPROP_P(object); if (!php_date_period_initialize_from_hash(period_obj, myht)) { - php_error(E_ERROR, "Invalid serialization data for DatePeriod object"); + zend_throw_error(NULL, "Invalid serialization data for DatePeriod object"); } } /* }}} */ @@ -5035,7 +5034,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi { zval *zv; if (type != BP_VAR_IS && type != BP_VAR_R) { - zend_throw_error(zend_ce_error, "Retrieval of DatePeriod properties for modification is unsupported"); + zend_throw_error(NULL, "Retrieval of DatePeriod properties for modification is unsupported"); return &EG(uninitialized_zval); } @@ -5054,7 +5053,7 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi /* {{{ date_period_write_property */ static void date_period_write_property(zval *object, zval *member, zval *value, void **cache_slot) { - zend_throw_error(zend_ce_error, "Writing to DatePeriod properties is unsupported"); + zend_throw_error(NULL, "Writing to DatePeriod properties is unsupported"); } /* }}} */ diff --git a/ext/date/tests/bug53437_var1.phpt b/ext/date/tests/bug53437_var1.phpt index f1f9843d5e..938439abe8 100644 --- a/ext/date/tests/bug53437_var1.phpt +++ b/ext/date/tests/bug53437_var1.phpt @@ -10,4 +10,9 @@ var_dump($dp); ?> ==DONE== --EXPECTF-- -Fatal error: Invalid serialization data for DatePeriod object in %sbug53437_var1.php on line %d +Fatal error: Uncaught Error: Invalid serialization data for DatePeriod object in %sbug53437_var1.php:%d +Stack trace: +#0 [internal function]: DatePeriod->__wakeup() +#1 %sbug53437_var1.php(%d): unserialize('O:10:"DatePerio...') +#2 {main} + thrown in %sbug53437_var1.php on line %d diff --git a/ext/date/tests/bug55397.phpt b/ext/date/tests/bug55397.phpt index 7c9bbb01c1..2ce1257710 100644 --- a/ext/date/tests/bug55397.phpt +++ b/ext/date/tests/bug55397.phpt @@ -7,4 +7,9 @@ date_default_timezone_set('Europe/Prague'); var_dump(unserialize('O:8:"DateTime":0:{}') == new DateTime); ?> --EXPECTF-- -Fatal error: Invalid serialization data for DateTime object in %sbug55397.php on line %d +Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug55397.php:%d +Stack trace: +#0 [internal function]: DateTime->__wakeup() +#1 %sbug55397.php(%d): unserialize('O:8:"DateTime":...') +#2 {main} + thrown in %sbug55397.php on line %d diff --git a/ext/date/tests/bug62852.phpt b/ext/date/tests/bug62852.phpt index 7013a3f97c..a1b5190281 100644 --- a/ext/date/tests/bug62852.phpt +++ b/ext/date/tests/bug62852.phpt @@ -11,4 +11,9 @@ try { } catch ( Exception $e ) {} --EXPECTF-- -Fatal error: Invalid serialization data for DateTime object in %sbug62852.php on line %d +Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug62852.php:%d +Stack trace: +#0 [internal function]: DateTime->__wakeup() +#1 %sbug62852.php(%d): unserialize('O:8:"DateTime":...') +#2 {main} + thrown in %sbug62852.php on line %d diff --git a/ext/date/tests/bug62852_var2.phpt b/ext/date/tests/bug62852_var2.phpt index f93ba28ab1..9d742d9363 100644 --- a/ext/date/tests/bug62852_var2.phpt +++ b/ext/date/tests/bug62852_var2.phpt @@ -22,4 +22,10 @@ try { var_dump( $foo ); --EXPECTF-- -Fatal error: Invalid serialization data for DateTime object in %sbug62852_var2.php on line %d +Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug62852_var2.php:%d +Stack trace: +#0 %sbug62852_var2.php(%d): DateTime->__wakeup() +#1 [internal function]: Foo->__wakeup() +#2 %sbug62852_var2.php(%d): unserialize('O:3:"Foo":3:{s:...') +#3 {main} + thrown in %sbug62852_var2.php on line %d diff --git a/ext/date/tests/bug62852_var3.phpt b/ext/date/tests/bug62852_var3.phpt index 5a644b5470..bef8d4ec6b 100644 --- a/ext/date/tests/bug62852_var3.phpt +++ b/ext/date/tests/bug62852_var3.phpt @@ -22,4 +22,10 @@ try { var_dump( $foo ); --EXPECTF-- -Fatal error: Invalid serialization data for DateTime object in %sbug62852_var3.php on line %d +Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug62852_var3.php:%d +Stack trace: +#0 %sbug62852_var3.php(%d): DateTime->__wakeup() +#1 [internal function]: Foo->__wakeup() +#2 %sbug62852_var3.php(%d): unserialize('O:3:"Foo":3:{s:...') +#3 {main} + thrown in %sbug62852_var3.php on line %d diff --git a/ext/date/tests/bug66721.phpt b/ext/date/tests/bug66721.phpt index 4806712437..9effb7ca56 100644 --- a/ext/date/tests/bug66721.phpt +++ b/ext/date/tests/bug66721.phpt @@ -8,4 +8,9 @@ $y = 'O:8:"DateTime":3:{s:4:"date";s:19:"2014-02-15 02:00:51";s:13:"timezone_typ var_dump(unserialize($y)); ?> --EXPECTF-- -Fatal error: Invalid serialization data for DateTime object in %s on line %d +Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug66721.php:%d +Stack trace: +#0 [internal function]: DateTime->__wakeup() +#1 %sbug66721.php(%d): unserialize('O:8:"DateTime":...') +#2 {main} + thrown in %sbug66721.php on line %d diff --git a/ext/date/tests/bug68942_2.phpt b/ext/date/tests/bug68942_2.phpt index 54ffdb535e..9870bbce5c 100644 --- a/ext/date/tests/bug68942_2.phpt +++ b/ext/date/tests/bug68942_2.phpt @@ -6,4 +6,9 @@ $data = unserialize('a:2:{i:0;O:8:"DateTime":3:{s:4:"date";s:26:"2000-01-01 00:0 var_dump($data); ?> --EXPECTF-- -Fatal error: Invalid serialization data for DateTime object in %s%ebug68942_2.php on line %d +Fatal error: Uncaught Error: Invalid serialization data for DateTime object in %sbug68942_2.php:%d +Stack trace: +#0 [internal function]: DateTime->__wakeup() +#1 %sbug68942_2.php(%d): unserialize('a:2:{i:0;O:8:"D...') +#2 {main} + thrown in %sbug68942_2.php on line %d diff --git a/ext/dom/document.c b/ext/dom/document.c index eabc032a1b..70289cf54a 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1856,7 +1856,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type vptr = xmlSchemaNewValidCtxt(sptr); if (!vptr) { xmlSchemaFree(sptr); - php_error(E_ERROR, "Invalid Schema Validation Context"); + zend_throw_error(NULL, "Invalid Schema Validation Context"); RETURN_FALSE; } @@ -1956,7 +1956,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ vptr = xmlRelaxNGNewValidCtxt(sptr); if (!vptr) { xmlRelaxNGFree(sptr); - php_error(E_ERROR, "Invalid RelaxNG Validation Context"); + zend_throw_error(NULL, "Invalid RelaxNG Validation Context"); RETURN_FALSE; } @@ -2248,7 +2248,7 @@ PHP_METHOD(domdocument, registerNodeClass) RETURN_TRUE; } - zend_throw_error(zend_ce_error, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name)); + zend_throw_error(NULL, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name)); RETURN_FALSE; } /* }}} */ diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index c079ba5753..accf4f72eb 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -285,7 +285,7 @@ PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj) /* {{{ dom_read_na */ static int dom_read_na(dom_object *obj, zval *retval) { - zend_throw_error(zend_ce_error, "Cannot read property"); + zend_throw_error(NULL, "Cannot read property"); return FAILURE; } /* }}} */ @@ -293,7 +293,7 @@ static int dom_read_na(dom_object *obj, zval *retval) /* {{{ dom_write_na */ static int dom_write_na(dom_object *obj, zval *newval) { - zend_throw_error(zend_ce_error, "Cannot write property"); + zend_throw_error(NULL, "Cannot write property"); return FAILURE; } /* }}} */ diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 6b5d6392c7..6723e4abfe 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -4446,7 +4446,7 @@ static zend_string* _php_rfc822_write_address(ADDRESS *addresslist) char address[SENDBUFLEN]; if (_php_imap_address_size(addresslist) >= SENDBUFLEN) { - zend_throw_error(zend_ce_error, "Address buffer overflow"); + zend_throw_error(NULL, "Address buffer overflow"); return NULL; } address[0] = 0; diff --git a/ext/intl/idn/idn.c b/ext/intl/idn/idn.c index fed184e618..1489dab9b1 100644 --- a/ext/intl/idn/idn.c +++ b/ext/intl/idn/idn.c @@ -27,7 +27,6 @@ #include <unicode/uidna.h> #include <unicode/ustring.h> -#include "zend_exceptions.h" #include "ext/standard/php_string.h" #include "intl_error.h" @@ -166,7 +165,7 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS, RETURN_FALSE; } if (len >= 255) { - zend_throw_error(zend_ce_error, "ICU returned an unexpected length"); + zend_throw_error(NULL, "ICU returned an unexpected length"); uidna_close(uts46); zend_string_free(buffer); RETURN_FALSE; diff --git a/ext/intl/normalizer/normalizer_class.c b/ext/intl/normalizer/normalizer_class.c index 93a5624663..92e4402180 100644 --- a/ext/intl/normalizer/normalizer_class.c +++ b/ext/intl/normalizer/normalizer_class.c @@ -63,7 +63,7 @@ void normalizer_register_Normalizer_class( void ) /* Declare 'Normalizer' class properties. */ if( !Normalizer_ce_ptr ) { - zend_error( E_ERROR, + zend_throw_error( NULL, "Normalizer: attempt to create properties " "on a non-registered class." ); return; diff --git a/ext/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c index 96e52a15fd..07b52eb133 100644 --- a/ext/intl/transliterator/transliterator_class.c +++ b/ext/intl/transliterator/transliterator_class.c @@ -183,7 +183,7 @@ err: "Could not clone transliterator", 0 ); err_msg = intl_error_get_message( TRANSLITERATOR_ERROR_P( to_orig ) ); - zend_throw_error( zend_ce_error, "%s", ZSTR_VAL(err_msg) ); + zend_throw_error( NULL, "%s", ZSTR_VAL(err_msg) ); zend_string_free( err_msg ); /* if it's changed into a warning */ /* do not destroy tempz; we need to return something */ } diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c index 0ead76c894..ca7af91cdf 100644 --- a/ext/ldap/ldap.c +++ b/ext/ldap/ldap.c @@ -38,7 +38,6 @@ #include "php.h" #include "php_ini.h" -#include "zend_exceptions.h" #include <stddef.h> @@ -1864,7 +1863,7 @@ PHP_FUNCTION(ldap_modify_batch) oper = LDAP_MOD_REPLACE; break; default: - zend_throw_error(zend_ce_error, "Unknown and uncaught modification type."); + zend_throw_error(NULL, "Unknown and uncaught modification type."); RETVAL_FALSE; efree(ldap_mods[i]); num_mods = i; diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c index 14e8da4548..e151a8c537 100644 --- a/ext/mbstring/php_mbregex.c +++ b/ext/mbstring/php_mbregex.c @@ -28,7 +28,6 @@ #if HAVE_MBREGEX -#include "zend_exceptions.h" #include "zend_smart_str.h" #include "ext/standard/info.h" #include "php_mbregex.h" @@ -950,7 +949,10 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp if (zend_eval_stringl(ZSTR_VAL(eval_str), ZSTR_LEN(eval_str), &v, description) == FAILURE) { efree(description); zend_throw_error(NULL, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_str)); - /* zend_error() does not return in this case */ + onig_region_free(regs, 0); + smart_str_free(&out_buf); + smart_str_free(&eval_buf); + RETURN_FALSE; } /* result of eval */ diff --git a/ext/mysqli/mysqli.c b/ext/mysqli/mysqli.c index be6c30d46b..1e3cdad28f 100644 --- a/ext/mysqli/mysqli.c +++ b/ext/mysqli/mysqli.c @@ -283,7 +283,7 @@ static void mysqli_warning_free_storage(zend_object *object) /* {{{ mysqli_read_na */ static zval *mysqli_read_na(mysqli_object *obj, zval *retval) { - zend_throw_error(zend_ce_error, "Cannot read property"); + zend_throw_error(NULL, "Cannot read property"); return NULL; } /* }}} */ @@ -291,7 +291,7 @@ static zval *mysqli_read_na(mysqli_object *obj, zval *retval) /* {{{ mysqli_write_na */ static int mysqli_write_na(mysqli_object *obj, zval *newval) { - zend_throw_error(zend_ce_error, "Cannot write property"); + zend_throw_error(NULL, "Cannot write property"); return FAILURE; } /* }}} */ diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index a3b8f2bac7..57ba87b205 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -31,7 +31,6 @@ #include "php_openssl.h" /* PHP Includes */ -#include "zend_exceptions.h" #include "ext/standard/file.h" #include "ext/standard/info.h" #include "ext/standard/php_fopen_wrappers.h" @@ -1826,7 +1825,7 @@ zend_string* php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_b php_error_docref(NULL, E_WARNING, "Unknown signature algorithm"); return NULL; } else if (!X509_digest(peer, mdtype, md, &n)) { - zend_throw_error(zend_ce_error, "Could not generate signature"); + zend_throw_error(NULL, "Could not generate signature"); return NULL; } diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c index 3138ee41d7..f1c58e2c0f 100644 --- a/ext/reflection/php_reflection.c +++ b/ext/reflection/php_reflection.c @@ -107,7 +107,7 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection) intern = Z_REFLECTION_P(getThis()); \ if (intern->ptr == NULL) { \ RETURN_ON_EXCEPTION \ - zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the reflection object"); \ + zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); \ return; \ } \ @@ -1499,7 +1499,7 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) { return NULL; } - zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the reflection object"); + zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); return NULL; } @@ -5190,7 +5190,7 @@ ZEND_METHOD(reflection_class, isSubclassOf) if (instanceof_function(Z_OBJCE_P(class_name), reflection_class_ptr)) { argument = Z_REFLECTION_P(class_name); if (argument->ptr == NULL) { - zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the argument's reflection object"); + zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object"); return; } class_ce = argument->ptr; @@ -5234,7 +5234,7 @@ ZEND_METHOD(reflection_class, implementsInterface) if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr)) { argument = Z_REFLECTION_P(interface); if (argument->ptr == NULL) { - zend_throw_error(zend_ce_error, "Internal error: Failed to retrieve the argument's reflection object"); + zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object"); return; } interface_ce = argument->ptr; @@ -5635,7 +5635,7 @@ ZEND_METHOD(reflection_property, getValue) return; } if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) { - zend_throw_error(zend_ce_error, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); + zend_throw_error(NULL, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); /* Bails out */ } member_p = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]; @@ -5702,7 +5702,7 @@ ZEND_METHOD(reflection_property, setValue) } if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) { - zend_throw_error(zend_ce_error, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); + zend_throw_error(NULL, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name)); return; } variable_ptr = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]; diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 6ac5a8cfef..beddce8883 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -20,7 +20,6 @@ #include "php.h" #include "php_session.h" -#include "zend_exceptions.h" #include "mod_user.h" ps_module ps_mod_user = { @@ -201,12 +200,12 @@ PS_CREATE_SID_FUNC(user) } zval_ptr_dtor(&retval); } else { - zend_throw_error(zend_ce_error, "No session id returned by function"); + zend_throw_error(NULL, "No session id returned by function"); return NULL; } if (!id) { - zend_throw_error(zend_ce_error, "Session id must be a string"); + zend_throw_error(NULL, "Session id must be a string"); return NULL; } diff --git a/ext/session/session.c b/ext/session/session.c index e3723a34c6..53dea3f4f2 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -40,7 +40,6 @@ #include "rfc1867.h" #include "php_variables.h" #include "php_session.h" -#include "zend_exceptions.h" #include "ext/standard/md5.h" #include "ext/standard/sha1.h" #include "ext/standard/php_var.h" @@ -349,7 +348,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ case PS_HASH_FUNC_OTHER: if (!PS(hash_ops)) { efree(buf); - zend_throw_error(zend_ce_error, "Invalid session hash function"); + zend_throw_error(NULL, "Invalid session hash function"); return NULL; } @@ -361,7 +360,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */ #endif /* HAVE_HASH_EXT */ default: efree(buf); - zend_throw_error(zend_ce_error, "Invalid session hash function"); + zend_throw_error(NULL, "Invalid session hash function"); return NULL; } efree(buf); @@ -530,7 +529,7 @@ static void php_session_initialize(void) /* {{{ */ PS(id) = PS(mod)->s_create_sid(&PS(mod_data)); if (!PS(id)) { php_session_abort(); - zend_throw_error(zend_ce_error, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); + zend_throw_error(NULL, "Failed to create session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path)); return; } if (PS(use_cookies)) { diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index d848fcac16..eeb5c10a81 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -250,7 +250,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z elements = 1; } else if (!member) { /* This happens when the user did: $sxe[]->foo = $value */ - zend_throw_error(zend_ce_error, "Cannot create unnamed attribute"); + zend_throw_error(NULL, "Cannot create unnamed attribute"); return &EG(uninitialized_zval); } name = NULL; @@ -277,7 +277,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z if (!member && node && node->parent && node->parent->type == XML_DOCUMENT_NODE) { /* This happens when the user did: $sxe[]->foo = $value */ - zend_throw_error(zend_ce_error, "Cannot create unnamed attribute"); + zend_throw_error(NULL, "Cannot create unnamed attribute"); return &EG(uninitialized_zval); } } @@ -459,7 +459,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool * and could also be E_PARSE, but we use this only during parsing * and this is during runtime. */ - zend_throw_error(zend_ce_error, "Cannot create unnamed attribute"); + zend_throw_error(NULL, "Cannot create unnamed attribute"); return FAILURE; } } else { @@ -498,7 +498,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool * and could also be E_PARSE, but we use this only during parsing * and this is during runtime. */ - zend_throw_error(zend_ce_error, "Cannot create unnamed attribute"); + zend_throw_error(NULL, "Cannot create unnamed attribute"); return FAILURE; } if (attribs && !node && sxe->iter.type == SXE_ITER_ELEMENT) { @@ -571,7 +571,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool if (elements) { if (!member || Z_TYPE_P(member) == IS_LONG) { if (node->type == XML_ATTRIBUTE_NODE) { - zend_throw_error(zend_ce_error, "Cannot create duplicate attribute"); + zend_throw_error(NULL, "Cannot create duplicate attribute"); if (new_value) { zval_ptr_dtor(value); } diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index f448912aeb..04fd0bd92f 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -355,7 +355,7 @@ static zend_object *spl_filesystem_object_clone(zval *zobject) intern->u.dir.index = index; break; case SPL_FS_FILE: - zend_throw_error(zend_ce_error, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name)); + zend_throw_error(NULL, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name)); return NULL; } diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 2f711ca2a6..abc855f341 100644 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1411,7 +1411,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS) success = SUCCESS; } else { - zend_throw_error(zend_ce_error, "Unable to call %s::%s()", intern->inner.ce->name, method); + zend_throw_error(NULL, "Unable to call %s::%s()", intern->inner.ce->name, method); success = FAILURE; } @@ -1712,7 +1712,7 @@ static inline void spl_dual_it_next(spl_dual_it_object *intern, int do_free) if (do_free) { spl_dual_it_free(intern); } else if (!intern->inner.iterator) { - zend_throw_error(zend_ce_error, "The inner constructor wasn't initialized with an iterator instance"); + zend_throw_error(NULL, "The inner constructor wasn't initialized with an iterator instance"); return; } intern->inner.iterator->funcs->move_forward(intern->inner.iterator); diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index 5fb5246d92..3a9341dd62 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -4825,7 +4825,8 @@ PHP_FUNCTION(forward_static_call) } if (!EX(prev_execute_data)->func->common.scope) { - zend_error(E_ERROR, "Cannot call forward_static_call() when no class scope is active"); + zend_throw_error(NULL, "Cannot call forward_static_call() when no class scope is active"); + return; } fci.retval = &retval; diff --git a/ext/standard/html.c b/ext/standard/html.c index ceb4f7c218..5492fc6a82 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1271,7 +1271,7 @@ PHPAPI zend_string *php_escape_html_entities_ex(unsigned char *old, size_t oldle } else { maxlen = 2 * oldlen; if (maxlen < oldlen) { - zend_error_noreturn(E_ERROR, "Input string is too long"); + zend_throw_error(NULL, "Input string is too long"); return NULL; } } diff --git a/ext/standard/tests/class_object/forward_static_call_002.phpt b/ext/standard/tests/class_object/forward_static_call_002.phpt index 58c4efd0cf..64406feb3e 100644 --- a/ext/standard/tests/class_object/forward_static_call_002.phpt +++ b/ext/standard/tests/class_object/forward_static_call_002.phpt @@ -18,4 +18,9 @@ test(); ?> --EXPECTF-- -Fatal error: Cannot call forward_static_call() when no class scope is active in %s on line %d +Fatal error: Uncaught Error: Cannot call forward_static_call() when no class scope is active in %s:%d +Stack trace: +#0 %s(%d): forward_static_call(Array) +#1 %s(%d): test() +#2 {main} + thrown in %s on line %d diff --git a/ext/tidy/tidy.c b/ext/tidy/tidy.c index 0c6c3e1385..0537c576c7 100644 --- a/ext/tidy/tidy.c +++ b/ext/tidy/tidy.c @@ -28,7 +28,6 @@ #if HAVE_TIDY #include "php_ini.h" -#include "zend_exceptions.h" #include "ext/standard/info.h" #include "tidy.h" @@ -1850,7 +1849,7 @@ static TIDY_NODE_METHOD(getParent) __constructor for tidyNode. */ static TIDY_NODE_METHOD(__construct) { - zend_throw_error(zend_ce_error, "You should not create a tidyNode manually"); + zend_throw_error(NULL, "You should not create a tidyNode manually"); } /* }}} */ diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c index daec4c1155..465bf51938 100644 --- a/ext/xmlrpc/xmlrpc-epi-php.c +++ b/ext/xmlrpc/xmlrpc-epi-php.c @@ -66,7 +66,6 @@ #endif #include "php.h" -#include "zend_exceptions.h" #include "ext/standard/info.h" #include "ext/standard/php_string.h" #include "ext/date/php_date.h" @@ -558,7 +557,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep ht = HASH_OF(&val); if (ht && ht->u.v.nApplyCount > 1) { - zend_throw_error(zend_ce_error, "XML-RPC doesn't support circular references"); + zend_throw_error(NULL, "XML-RPC doesn't support circular references"); return NULL; } diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index fca0a9d617..7c646e37a0 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -23,7 +23,6 @@ #include "php.h" #include "php_ini.h" -#include "zend_exceptions.h" #include "ext/standard/info.h" #include "ext/standard/file.h" #include "ext/standard/php_string.h" @@ -590,7 +589,7 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v globfree(&globbuf); return globbuf.gl_pathc; #else - zend_throw_error(zend_ce_error, "Glob support is not available"); + zend_throw_error(NULL, "Glob support is not available"); return 0; #endif /* HAVE_GLOB */ } |