]> granicus.if.org Git - php/commitdiff
E_RECOVERABLE_ERROR -> thrown Error
authorAaron Piotrowski <aaron@trowski.com>
Tue, 14 Jun 2016 16:32:33 +0000 (11:32 -0500)
committerAaron Piotrowski <aaron@trowski.com>
Tue, 14 Jun 2016 18:18:43 +0000 (13:18 -0500)
20 files changed:
ext/dba/dba.c
ext/dba/libinifile/inifile.c
ext/intl/collator/collator_compare.c
ext/intl/collator/collator_locale.c
ext/intl/collator/collator_sort.c
ext/intl/tests/bug60192-compare.phpt
ext/intl/tests/bug60192-getlocale.phpt
ext/intl/tests/bug60192-getsortkey.phpt
ext/intl/tests/bug60192-sort.phpt
ext/intl/tests/bug60192-sortwithsortkeys.phpt
ext/mcrypt/mcrypt.c
ext/session/session.c
ext/spl/spl_array.c
ext/spl/tests/array_013.phpt
ext/standard/assert.c
ext/standard/php_fopen_wrapper.c
ext/standard/tests/assert/assert02.phpt
ext/standard/tests/assert/assert_error3.phpt
ext/standard/tests/assert/assert_error4.phpt
ext/wddx/wddx.c

index fd4522b9d6684a114d33d53ed835ce67830ba981..66af2436bb416aaf8daad39e5f27855f2a0ed043 100644 (file)
@@ -208,7 +208,7 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free)
                size_t len;
 
                if (zend_hash_num_elements(Z_ARRVAL_P(key)) != 2) {
-                       php_error_docref(NULL, E_RECOVERABLE_ERROR, "Key does not have exactly two elements: (key, name)");
+                       zend_throw_error(NULL, "Key does not have exactly two elements: (key, name)");
                        return 0;
                }
                zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos);
index f5b5ea2aa882feca4f4bc1874f9f1f9d57f7ea02..18a7cb97a7af4cbf16aa892806bd7044642713b4 100644 (file)
@@ -542,7 +542,7 @@ static int inifile_delete_replace_append(inifile *dba, const key_type *key, cons
                        php_stream_seek(fp_tmp, 0, SEEK_SET);
                        php_stream_seek(dba->fp, 0, SEEK_END);
                        if (SUCCESS != php_stream_copy_to_stream_ex(fp_tmp, dba->fp, PHP_STREAM_COPY_ALL, NULL)) {
-                               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Could not copy from temporary stream - ini file truncated");
+                               zend_throw_error(NULL, "Could not copy from temporary stream - ini file truncated");
                                ret = FAILURE;
                        }
                }
index a7bc7f638364928845515549d0759fe5d479ec87..983b9d7f2c1169fb5c4564f437a38a61b43cfa3f 100644 (file)
@@ -62,7 +62,7 @@ PHP_FUNCTION( collator_compare )
                intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) );
                intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
                        "Object not initialized", 0 );
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized");
+               zend_throw_error(NULL, "Object not initialized");
 
                RETURN_FALSE;
        }
index 8e0b32650a76a797a89c2e54525df33275afe55b..b3ea572be1b592af4bb75727bf519e7ce1920bfa 100644 (file)
@@ -55,7 +55,7 @@ PHP_FUNCTION( collator_get_locale )
                intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) );
                intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
                        "Object not initialized", 0 );
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized");
+               zend_throw_error(NULL, "Object not initialized");
 
                RETURN_FALSE;
        }
index 1ad42d3660f076c2e176b37347100403202ccacc..6de1fa3619d5e0ee18b5686aa86b27ca2467f2ff 100644 (file)
@@ -75,8 +75,8 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2)
                        intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) );
                        intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
                                "Object not initialized", 0 );
-                       php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized");
-
+                       zend_throw_error(NULL, "Object not initialized");
+                       return FAILURE;
                }
 
                /* Compare the strings using ICU. */
@@ -404,7 +404,7 @@ PHP_FUNCTION( collator_sort_with_sort_keys )
                intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) );
                intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
                        "Object not initialized", 0 );
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized");
+               zend_throw_error(NULL, "Object not initialized");
 
                RETURN_FALSE;
        }
@@ -570,7 +570,7 @@ PHP_FUNCTION( collator_get_sort_key )
                intl_error_set_code( NULL, COLLATOR_ERROR_CODE( co ) );
                intl_errors_set_custom_msg( COLLATOR_ERROR_P( co ),
                        "Object not initialized", 0 );
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Object not initialized");
+               zend_throw_error(NULL, "Object not initialized");
 
                RETURN_FALSE;
        }
index 12f3273538bfe8cf6861f2b96d3e2f37e97e0810..ce9728023ab608bbb69776789b365dd7d7dbc546 100644 (file)
@@ -16,4 +16,8 @@ $c = new Collator2();
 $a = $c->compare('h', 'H');
 --EXPECTF--
 
-Catchable fatal error: Collator::compare(): Object not initialized in %s on line %d
+Fatal error: Uncaught Error: Object not initialized in %s:%d
+Stack trace:
+#0 %s(%d): Collator->compare('h', 'H')
+#1 {main}
+  thrown in %s on line %d
index 9f340c5f67b5349029abfe0a07208eb12abc7e8c..c4155e9ab5eab0627cba6556b4135721e543c131 100644 (file)
@@ -17,4 +17,8 @@ $c = new Collator2();
 $c->getLocale(Locale::ACTUAL_LOCALE);
 --EXPECTF--
 
-Catchable fatal error: Collator::getLocale(): Object not initialized in %s on line %d
+Fatal error: Uncaught Error: Object not initialized in %s:%d
+Stack trace:
+#0 %s(%d): Collator->getLocale(0)
+#1 {main}
+  thrown in %s on line %d
index f3e68f9c61f6c7055178ba56146fa64e04b0f0e4..0d0f07e768caeb37d09b7d767ba6146d780d8aae 100644 (file)
@@ -17,4 +17,8 @@ $c = new Collator2();
 $c->getSortKey('h');
 --EXPECTF--
 
-Catchable fatal error: Collator::getSortKey(): Object not initialized in %s on line %d
+Fatal error: Uncaught Error: Object not initialized in %s:%d
+Stack trace:
+#0 %s(%d): Collator->getSortKey('h')
+#1 {main}
+  thrown in %s on line %d
index ee506d3a5a755393a1e6daf9afe4276fa1c93cee..c452d0de6dc0526d1620c3fe3b74d71c86e8fa54 100644 (file)
@@ -18,4 +18,9 @@ $a = array('a', 'b');
 $c->sort($a);
 --EXPECTF--
 
-Catchable fatal error: Collator::sort(): Object not initialized in %s on line %d
+Fatal error: Uncaught Error: Object not initialized in %s:%d
+Stack trace:
+#0 %s(%d): Collator->sort(Array)
+#1 {main}
+  thrown in %s on line %d
+
index c26b2daf85f13705b49ed7bb69a6e90dfebdc3e6..e7d7c1dc1d1e32cf7807958d0417837fa6f28a89 100644 (file)
@@ -18,4 +18,9 @@ $a = array('a', 'b');
 $c->sortWithSortKeys($a);
 --EXPECTF--
 
-Catchable fatal error: Collator::sortWithSortKeys(): Object not initialized in %s on line %d
+Fatal error: Uncaught Error: Object not initialized in %s:%d
+Stack trace:
+#0 %s(%d): Collator->sortWithSortKeys(Array)
+#1 {main}
+  thrown in %s on line %d
+
index 073bfec7759a7921d3c51b55a8f5ac42855a47f9..b49a3ba35649e65bd3fc6eff48420a39fb396002 100644 (file)
@@ -1283,7 +1283,7 @@ static void php_mcrypt_do_crypt(char* cipher, const char *key, size_t key_len, c
        }
 
        if (mcrypt_generic_init(td, (void *) key, (int)key_len, (void *) iv) < 0) {
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Mcrypt initialisation failed");
+               zend_throw_error(NULL, "Mcrypt initialisation failed");
                mcrypt_module_close(td);
                RETURN_FALSE;
        }
index 53dea3f4f2c4ba46808112698911f65cd191e85e..3d40f2977d34b639078eca2b2cc4a091292c264f 100644 (file)
@@ -2130,14 +2130,14 @@ static PHP_FUNCTION(session_regenerate_id)
 
        if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE) {
                PS(session_status) = php_session_none;
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+               zend_throw_error(NULL, "Failed to open session: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                RETURN_FALSE;
        }
 
        PS(id) = PS(mod)->s_create_sid(&PS(mod_data));
        if (!PS(id)) {
                PS(session_status) = php_session_none;
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+               zend_throw_error(NULL, "Failed to create new session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                RETURN_FALSE;
        }
        if (PS(use_strict_mode) && PS(mod)->s_validate_sid &&
@@ -2147,7 +2147,7 @@ static PHP_FUNCTION(session_regenerate_id)
                if (!PS(id)) {
                        PS(mod)->s_close(&PS(mod_data));
                        PS(session_status) = php_session_none;
-                       php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+                       zend_throw_error(NULL, "Failed to create session ID by collision: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                        RETURN_FALSE;
                }
        }
@@ -2155,7 +2155,7 @@ static PHP_FUNCTION(session_regenerate_id)
        if (PS(mod)->s_read(&PS(mod_data), PS(id), &data, PS(gc_maxlifetime)) == FAILURE) {
                PS(mod)->s_close(&PS(mod_data));
                PS(session_status) = php_session_none;
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+               zend_throw_error(NULL, "Failed to create(read) session ID: %s (path: %s)", PS(mod)->s_name, PS(save_path));
                RETURN_FALSE;
        }
        if (data) {
index 60cbac572697ead5ca180c976cda09928d94005d..8b95358717756b7c00a7536141064ff752042d01 100644 (file)
@@ -770,7 +770,7 @@ void spl_array_iterator_append(zval *object, zval *append_value) /* {{{ */
        }
 
        if (spl_array_is_object(intern)) {
-               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Cannot append properties to objects, use %s::offsetSet() instead", ZSTR_VAL(Z_OBJCE_P(object)->name));
+               zend_throw_error(NULL, "Cannot append properties to objects, use %s::offsetSet() instead", ZSTR_VAL(Z_OBJCE_P(object)->name));
                return;
        }
 
index 3fda53884f1634b94962f91e42d39d1f50dd7146..c2dc1f49891f56de09eafc742a51733fca4512ae 100644 (file)
@@ -76,4 +76,8 @@ one=>1
 two=>2
 ===Append===
 
-Catchable fatal error: ArrayIterator::append(): Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %sarray_013.php on line %d
+Fatal error: Uncaught Error: Cannot append properties to objects, use ArrayIterator::offsetSet() instead in %s:%d
+Stack trace:
+#0 %s(%d): ArrayIterator->append('three')
+#1 {main}
+  thrown in %s on line %d
\ No newline at end of file
index 016c90e02e72baba3fb2364c8b4394535ef6c5f1..05d0387224304a05a885681fece9fe87d3f51290 100644 (file)
@@ -180,10 +180,10 @@ PHP_FUNCTION(assert)
                if (zend_eval_stringl(myeval, Z_STRLEN_P(assertion), &retval, compiled_string_description) == FAILURE) {
                        efree(compiled_string_description);
                        if (!description) {
-                               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s", PHP_EOL, myeval);
+                               zend_throw_error(NULL, "Failure evaluating code: %s%s", PHP_EOL, myeval);
                        } else {
                                zend_string *str = zval_get_string(description);
-                               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval);
+                               zend_throw_error(NULL, "Failure evaluating code: %s%s:\"%s\"", PHP_EOL, ZSTR_VAL(str), myeval);
                                zend_string_release(str);
                        }
                        if (ASSERTG(bail)) {
index 759a4f6a3327ba598e87ffffbb3ae61ff671e0b8..cfe047930c9b3013fa6ff8b0a9601c77d71fbc29 100644 (file)
@@ -195,7 +195,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
                        path += 11;
                        max_memory = ZEND_STRTOL(path, NULL, 10);
                        if (max_memory < 0) {
-                               php_error_docref(NULL, E_RECOVERABLE_ERROR, "Max memory must be >= 0");
+                               zend_throw_error(NULL, "Max memory must be >= 0");
                                return NULL;
                        }
                }
@@ -353,7 +353,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
                pathdup = estrndup(path + 6, strlen(path + 6));
                p = strstr(pathdup, "/resource=");
                if (!p) {
-                       php_error_docref(NULL, E_RECOVERABLE_ERROR, "No URL resource specified");
+                       zend_throw_error(NULL, "No URL resource specified");
                        efree(pathdup);
                        return NULL;
                }
index 723eeb956475a2b489b1a96f7bfd0fd42cdc31b9..db60f41466032d3881a7226a1264881618ade7c6 100644 (file)
@@ -8,41 +8,47 @@ assert.bail=0
 assert.quiet_eval=0
 --FILE--
 <?php
-function handler($errno, $errstr) {
-       echo "in handler()\n";
-       assert(E_RECOVERABLE_ERROR === $errno);
-       var_dump($errstr);
-}
-
-set_error_handler('handler', E_RECOVERABLE_ERROR);
 
 assert(1);
 assert('1');
 assert('$a');
 
-assert('aa=sd+as+safsafasfasafsaf');
+try {
+       assert('aa=sd+as+safsafasfasafsaf');
+} catch (Throwable $e) {
+       echo $e->getMessage(), "\n";
+}
 
 assert('0');
 
 assert_options(ASSERT_BAIL, 1);
-assert('aa=sd+as+safsafasfasafsaf');
+
+try {
+       assert('aa=sd+as+safsafasfasafsaf');
+} catch (Throwable $e) {
+       echo $e->getMessage(), "\n";
+}
 
 echo "done\n";
 
 ?>
 --EXPECTF--
-Notice: Undefined variable: a in %sassert02.php(12) : assert code on line 1
+Notice: Undefined variable: a in %sassert02.php(%d) : assert code on line 1
 
-Warning: assert(): Assertion "$a" failed in %sassert02.php on line 12
+Warning: assert(): Assertion "$a" failed in %sassert02.php on line %d
+Failure evaluating code: 
+aa=sd+as+safsafasfasafsaf
 
-Parse error: %s error%sin %sassert02.php(14) : assert code on line 1
-in handler()
-%string|unicode%(%d) "assert(): Failure evaluating code: 
-aa=sd+as+safsafasfasafsaf"
+Warning: assert(): Assertion "0" failed in %sassert02.php on line %d
 
-Warning: assert(): Assertion "0" failed in %sassert02.php on line 16
+Fatal error: Uncaught ParseError: syntax error, unexpected '=', expecting ';' in %s(%d) : assert code:1
+Stack trace:
+#0 %s(%d): assert('aa=sd+as+safsaf...')
+#1 {main}
 
-Parse error: %s error%sin %sassert02.php(19) : assert code on line 1
-in handler()
-%string|unicode%(%d) "assert(): Failure evaluating code: 
-aa=sd+as+safsafasfasafsaf"
+Next Error: Failure evaluating code: 
+aa=sd+as+safsafasfasafsaf in %s:%d
+Stack trace:
+#0 %s(%d): assert('aa=sd+as+safsaf...')
+#1 {main}
+  thrown in %s on line %d
\ No newline at end of file
index d14397515fcbe69126f498ff22486653df6ef128..80947421f19ae4b34b33b30e49c606f743c0ab22 100644 (file)
@@ -13,8 +13,14 @@ display_errors = 1
 var_dump($r2 = assert("0 $ 0"));
 --EXPECTF--
 
-Parse error: syntax error, unexpected '$', expecting ';' in %s(2) : assert code on line 1
-
-Catchable fatal error: assert(): Failure evaluating code: 
-0 $ 0 in %s on line 2
+Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
+Stack trace:
+#0 %s(%d): assert('0 $ 0')
+#1 {main}
 
+Next Error: Failure evaluating code: 
+0 $ 0 in %s:%d
+Stack trace:
+#0 %s(%d): assert('0 $ 0')
+#1 {main}
+  thrown in %s on line %d
\ No newline at end of file
index 41d404b1f32466bbf689137acf5ae9ac8c254509..e4d27aecefd6317773beaf99a99ccfe2f389ebe5 100644 (file)
@@ -14,8 +14,14 @@ $sa = "0 $ 0";
 var_dump($r2 = assert($sa, "Describing what was asserted"));
 --EXPECTF--
 
-Parse error: syntax error, %s in %s(3) : assert code on line 1
-
-Catchable fatal error: assert(): Failure evaluating code: 
-Describing what was asserted:"0 $ 0" in %s on line 3
+Fatal error: Uncaught ParseError: syntax error, unexpected '$', expecting ';' in %s(%d) : assert code:1
+Stack trace:
+#0 %s(%d): assert('0 $ 0', 'Describing what...')
+#1 {main}
 
+Next Error: Failure evaluating code: 
+Describing what was asserted:"0 $ 0" in %s:%d
+Stack trace:
+#0 %s(%d): assert('0 $ 0', 'Describing what...')
+#1 {main}
+  thrown in %s on line %d
index e848afdeb71226046b08dec9c0da616043ec7ef6..eaa5e9b4f15deb0f9d7b2518c6cf068684432941 100644 (file)
@@ -626,7 +626,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name)
                case IS_ARRAY:
                        ht = Z_ARRVAL_P(var);
                        if (ht->u.v.nApplyCount > 1) {
-                               php_error_docref(NULL, E_RECOVERABLE_ERROR, "WDDX doesn't support circular references");
+                               zend_throw_error(NULL, "WDDX doesn't support circular references");
                                return;
                        }
                        if (ZEND_HASH_APPLY_PROTECTION(ht)) {
@@ -641,7 +641,7 @@ void php_wddx_serialize_var(wddx_packet *packet, zval *var, zend_string *name)
                case IS_OBJECT:
                        ht = Z_OBJPROP_P(var);
                        if (ht->u.v.nApplyCount > 1) {
-                               php_error_docref(NULL, E_RECOVERABLE_ERROR, "WDDX doesn't support circular references");
+                               zend_throw_error(NULL, "WDDX doesn't support circular references");
                                return;
                        }
                        ht->u.v.nApplyCount++;