summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Piotrowski <aaron@trowski.com>2016-06-14 11:32:33 -0500
committerAaron Piotrowski <aaron@trowski.com>2016-06-14 13:18:43 -0500
commit7d53864574e22a3f72fcee7eb902248fb25f85df (patch)
tree19e9f8a5a99ae125ccd94124d32712ddb9c5eddb
parent771e5cc24716304dd2bf8cbd8aec11d465965d0a (diff)
downloadphp-git-7d53864574e22a3f72fcee7eb902248fb25f85df.tar.gz
E_RECOVERABLE_ERROR -> thrown Error
-rw-r--r--ext/dba/dba.c2
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/intl/collator/collator_compare.c2
-rw-r--r--ext/intl/collator/collator_locale.c2
-rw-r--r--ext/intl/collator/collator_sort.c8
-rw-r--r--ext/intl/tests/bug60192-compare.phpt6
-rw-r--r--ext/intl/tests/bug60192-getlocale.phpt6
-rw-r--r--ext/intl/tests/bug60192-getsortkey.phpt6
-rw-r--r--ext/intl/tests/bug60192-sort.phpt7
-rw-r--r--ext/intl/tests/bug60192-sortwithsortkeys.phpt7
-rw-r--r--ext/mcrypt/mcrypt.c2
-rw-r--r--ext/session/session.c8
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/tests/array_013.phpt6
-rw-r--r--ext/standard/assert.c4
-rw-r--r--ext/standard/php_fopen_wrapper.c4
-rw-r--r--ext/standard/tests/assert/assert02.phpt46
-rw-r--r--ext/standard/tests/assert/assert_error3.phpt14
-rw-r--r--ext/standard/tests/assert/assert_error4.phpt14
-rw-r--r--ext/wddx/wddx.c4
20 files changed, 98 insertions, 54 deletions
diff --git a/ext/dba/dba.c b/ext/dba/dba.c
index fd4522b9d6..66af2436bb 100644
--- a/ext/dba/dba.c
+++ b/ext/dba/dba.c
@@ -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);
diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c
index f5b5ea2aa8..18a7cb97a7 100644
--- a/ext/dba/libinifile/inifile.c
+++ b/ext/dba/libinifile/inifile.c
@@ -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;
}
}
diff --git a/ext/intl/collator/collator_compare.c b/ext/intl/collator/collator_compare.c
index a7bc7f6383..983b9d7f2c 100644
--- a/ext/intl/collator/collator_compare.c
+++ b/ext/intl/collator/collator_compare.c
@@ -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;
}
diff --git a/ext/intl/collator/collator_locale.c b/ext/intl/collator/collator_locale.c
index 8e0b32650a..b3ea572be1 100644
--- a/ext/intl/collator/collator_locale.c
+++ b/ext/intl/collator/collator_locale.c
@@ -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;
}
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c
index 1ad42d3660..6de1fa3619 100644
--- a/ext/intl/collator/collator_sort.c
+++ b/ext/intl/collator/collator_sort.c
@@ -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;
}
diff --git a/ext/intl/tests/bug60192-compare.phpt b/ext/intl/tests/bug60192-compare.phpt
index 12f3273538..ce9728023a 100644
--- a/ext/intl/tests/bug60192-compare.phpt
+++ b/ext/intl/tests/bug60192-compare.phpt
@@ -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
diff --git a/ext/intl/tests/bug60192-getlocale.phpt b/ext/intl/tests/bug60192-getlocale.phpt
index 9f340c5f67..c4155e9ab5 100644
--- a/ext/intl/tests/bug60192-getlocale.phpt
+++ b/ext/intl/tests/bug60192-getlocale.phpt
@@ -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
diff --git a/ext/intl/tests/bug60192-getsortkey.phpt b/ext/intl/tests/bug60192-getsortkey.phpt
index f3e68f9c61..0d0f07e768 100644
--- a/ext/intl/tests/bug60192-getsortkey.phpt
+++ b/ext/intl/tests/bug60192-getsortkey.phpt
@@ -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
diff --git a/ext/intl/tests/bug60192-sort.phpt b/ext/intl/tests/bug60192-sort.phpt
index ee506d3a5a..c452d0de6d 100644
--- a/ext/intl/tests/bug60192-sort.phpt
+++ b/ext/intl/tests/bug60192-sort.phpt
@@ -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
+
diff --git a/ext/intl/tests/bug60192-sortwithsortkeys.phpt b/ext/intl/tests/bug60192-sortwithsortkeys.phpt
index c26b2daf85..e7d7c1dc1d 100644
--- a/ext/intl/tests/bug60192-sortwithsortkeys.phpt
+++ b/ext/intl/tests/bug60192-sortwithsortkeys.phpt
@@ -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
+
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 073bfec775..b49a3ba356 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -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;
}
diff --git a/ext/session/session.c b/ext/session/session.c
index 53dea3f4f2..3d40f2977d 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -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) {
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 60cbac5726..8b95358717 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -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;
}
diff --git a/ext/spl/tests/array_013.phpt b/ext/spl/tests/array_013.phpt
index 3fda53884f..c2dc1f4989 100644
--- a/ext/spl/tests/array_013.phpt
+++ b/ext/spl/tests/array_013.phpt
@@ -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
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 016c90e02e..05d0387224 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -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)) {
diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index 759a4f6a33..cfe047930c 100644
--- a/ext/standard/php_fopen_wrapper.c
+++ b/ext/standard/php_fopen_wrapper.c
@@ -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;
}
diff --git a/ext/standard/tests/assert/assert02.phpt b/ext/standard/tests/assert/assert02.phpt
index 723eeb9564..db60f41466 100644
--- a/ext/standard/tests/assert/assert02.phpt
+++ b/ext/standard/tests/assert/assert02.phpt
@@ -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
diff --git a/ext/standard/tests/assert/assert_error3.phpt b/ext/standard/tests/assert/assert_error3.phpt
index d14397515f..80947421f1 100644
--- a/ext/standard/tests/assert/assert_error3.phpt
+++ b/ext/standard/tests/assert/assert_error3.phpt
@@ -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
diff --git a/ext/standard/tests/assert/assert_error4.phpt b/ext/standard/tests/assert/assert_error4.phpt
index 41d404b1f3..e4d27aecef 100644
--- a/ext/standard/tests/assert/assert_error4.phpt
+++ b/ext/standard/tests/assert/assert_error4.phpt
@@ -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
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index e848afdeb7..eaa5e9b4f1 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -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++;