]> granicus.if.org Git - php/commitdiff
Replace zend_ce_error with NULL and replace more E_ERROR with thrown Error
authorAaron Piotrowski <aaron@trowski.com>
Sat, 11 Jun 2016 17:07:28 +0000 (12:07 -0500)
committerAaron Piotrowski <aaron@trowski.com>
Mon, 13 Jun 2016 14:02:17 +0000 (09:02 -0500)
30 files changed:
ext/date/php_date.c
ext/date/tests/bug53437_var1.phpt
ext/date/tests/bug55397.phpt
ext/date/tests/bug62852.phpt
ext/date/tests/bug62852_var2.phpt
ext/date/tests/bug62852_var3.phpt
ext/date/tests/bug66721.phpt
ext/date/tests/bug68942_2.phpt
ext/dom/document.c
ext/dom/php_dom.c
ext/imap/php_imap.c
ext/intl/idn/idn.c
ext/intl/normalizer/normalizer_class.c
ext/intl/transliterator/transliterator_class.c
ext/ldap/ldap.c
ext/mbstring/php_mbregex.c
ext/mysqli/mysqli.c
ext/openssl/openssl.c
ext/reflection/php_reflection.c
ext/session/mod_user.c
ext/session/session.c
ext/simplexml/simplexml.c
ext/spl/spl_directory.c
ext/spl/spl_iterators.c
ext/standard/basic_functions.c
ext/standard/html.c
ext/standard/tests/class_object/forward_static_call_002.phpt
ext/tidy/tidy.c
ext/xmlrpc/xmlrpc-epi-php.c
ext/zip/php_zip.c

index d8e6ba641914f3a0fde2913e6d28dacd2efeab43..e76ca7f72346aae63ffa4cd1dff613718bad631e 100644 (file)
@@ -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");
 }
 /* }}} */
 
index f1f9843d5ee1cf3da914c8b3bb03ae354942b8c9..938439abe88378ffb8c633f73589e58d38d163e3 100644 (file)
@@ -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
index 7c9bbb01c1f382c697d4abb963b0d6a624c68d48..2ce12577101e50352b96d8326631a32d58069a54 100644 (file)
@@ -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
index 7013a3f97c52295fc04c45982be800f45be6351c..a1b5190281d2c6b4aaaf0b153ccc5eed7e783e43 100644 (file)
@@ -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
index f93ba28ab1f09dc758a3413b3a71ec8128a20b05..9d742d936361ae1867dd45755e9396a339f23014 100644 (file)
@@ -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
index 5a644b54709f6095c999c879564bd7e03ac7d488..bef8d4ec6b2f7e02df40802b842226cce078c943 100644 (file)
@@ -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
index 48067124375d13a04b343357d87e8f52e0e044be..9effb7ca5622e4f57ceb0573ca7daef01d461676 100644 (file)
@@ -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
index 54ffdb535e979a9583446f64a57fc0e7e048f80a..9870bbce5c99755c8a8b51c617a60787c51be872 100644 (file)
@@ -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
index eabc032a1bbaf53c486d4e202aa71375c34fc794..70289cf54a003136c7374d23c0e98d386dcc3252 100644 (file)
@@ -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;
 }
 /* }}} */
index c079ba57536f9673a7946c1161f6d98cfc37ab18..accf4f72ebb1e0cd6606df0081579c9f1d79f082 100644 (file)
@@ -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;
 }
 /* }}} */
index 6b5d6392c71be9362ddfe397291ad05dd008f913..6723e4abfee2129979c314cc6d4e2f1e609e3b56 100644 (file)
@@ -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;
index fed184e61868489e0a13b2df37810f179bc42c43..1489dab9b168ee8761bbe8241b059411935ee238 100644 (file)
@@ -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;
index 93a56246637e085758248083c653078324db02eb..92e440218098715e37a7935850b19a5fe15c30ec 100644 (file)
@@ -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;
index 96e52a15fd4483477951c79eae47bafecd868b2d..07b52eb1339836f324a38c5b6371767f05bd7c30 100644 (file)
@@ -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 */
                }
index 0ead76c8941213645917bff1218d8d20db9598d9..ca7af91cdfe7124192ace34ffc2d3d5b9191510f 100644 (file)
@@ -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;
index 14e8da4548376fa6d74ec11f8cc3a59afa926698..e151a8c537899f4d9660068aa019a22a72d51674 100644 (file)
@@ -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 */
index be6c30d46bb66ec716cdc61ea2c082896dda430f..1e3cdad28fe5b9f3e1be6f92c0fbc0d5d071c53f 100644 (file)
@@ -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;
 }
 /* }}} */
index a3b8f2bac7c9d6e5a674c97f64e01cee75c39d3a..57ba87b205ed775840bc7d6ec1283dd26c20360c 100644 (file)
@@ -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;
        }
 
index 3138ee41d7ea2854b6dd7624d5b867b2b85db472..f1c58e2c0fdbc8166612b0e7ed21d6be82b9fcf8 100644 (file)
@@ -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];
index 6ac5a8cfef20f70f901bce71954acd7e2f5337c5..beddce8883543183d0e32fd3fe540d7db4473b09 100644 (file)
@@ -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;
                }
 
index e3723a34c68ca35ca419e2b55dbbee882e0f71b7..53dea3f4f2c4ba46808112698911f65cd191e85e 100644 (file)
@@ -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)) {
index d848fcac16fab37e53c13326a72ad39da5f290e2..eeb5c10a81c029ca1e18f22b16cc63925500d9a5 100644 (file)
@@ -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);
                                        }
index f448912aeb28c72a6db3346dce88c783248c7ab4..04fd0bd92f53fb7de05b3b82a70c3558b1ca6f39 100644 (file)
@@ -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;
        }
 
index 2f711ca2a6e2346674c88577e3f1044dac453e5d..abc855f341996825f0edc02593b1a6ed434a7ea0 100644 (file)
@@ -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);
index 5fb5246d92a08b50da4cc8b337d4722ab161c3c4..3a9341dd624d21fc1299b4c746a718e4c3f83410 100644 (file)
@@ -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;
index ceb4f7c2185fcabddce05ccae55e52321c743dd9..5492fc6a82877621eecc4f813922d7f09ac32036 100644 (file)
@@ -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;
                }
        }
index 58c4efd0cfb24e6aaa73acc6f532c3ecfd741d11..64406feb3e40900439b9c8659904a923b46eaf01 100644 (file)
@@ -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
index 0c6c3e1385c18df757b6db7a1f39bb5990337233..0537c576c704416b197c178d0f3405012cb4b989 100644 (file)
@@ -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");
 }
 /* }}} */
 
index daec4c115515aa2dd9ab9e66785fb8b67d8d41ce..465bf51938fe8d4ca571c1c8942429162372b805 100644 (file)
@@ -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;
                                                }
 
index fca0a9d617e1488e79f262af851df0ab88db59d1..7c646e37a06664d511c2f238f0f22efbd877360a 100644 (file)
@@ -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 */
 }