summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAaron Piotrowski <aaron@trowski.com>2016-07-05 02:08:39 -0500
committerAaron Piotrowski <aaron@trowski.com>2016-07-05 02:08:39 -0500
commit24237027bc7e4f7aed9287fe9815c0577eeb1c22 (patch)
treebc23b05ba89a75f0e0711933371f708b96e63345 /ext
parent42666da1714673d537356221e688f57f404fe1d2 (diff)
parente9832b5ab1d986ddd3ea0705bcbc5a391dc16614 (diff)
downloadphp-git-24237027bc7e4f7aed9287fe9815c0577eeb1c22.tar.gz
Merge branch 'throw-error-in-extensions'
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c22
-rw-r--r--ext/date/tests/bug53437_var1.phpt7
-rw-r--r--ext/date/tests/bug55397.phpt7
-rw-r--r--ext/date/tests/bug62852.phpt7
-rw-r--r--ext/date/tests/bug62852_var2.phpt8
-rw-r--r--ext/date/tests/bug62852_var3.phpt8
-rw-r--r--ext/date/tests/bug66721.phpt7
-rw-r--r--ext/date/tests/bug68942.phpt7
-rw-r--r--ext/date/tests/bug68942_2.phpt7
-rw-r--r--ext/dba/dba.c2
-rw-r--r--ext/dba/libinifile/inifile.c2
-rw-r--r--ext/dom/document.c14
-rw-r--r--ext/dom/php_dom.c9
-rw-r--r--ext/dom/php_dom.h2
-rw-r--r--ext/imap/php_imap.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/idn/idn.c5
-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/intl/transliterator/transliterator_class.c2
-rw-r--r--ext/ldap/ldap.c9
-rw-r--r--ext/mbstring/php_mbregex.c7
-rw-r--r--ext/mbstring/tests/bug43301.phpt13
-rw-r--r--ext/mcrypt/mcrypt.c2
-rw-r--r--ext/mysqli/mysqli.c4
-rw-r--r--ext/pdo_odbc/pdo_odbc.c2
-rw-r--r--ext/reflection/php_reflection.c22
-rw-r--r--ext/session/mod_user.c4
-rw-r--r--ext/session/session.c14
-rw-r--r--ext/session/tests/session_save_path_variation4.phpt1
-rw-r--r--ext/session/tests/session_set_save_handler_sid_002.phpt11
-rw-r--r--ext/simplexml/simplexml.c17
-rw-r--r--ext/simplexml/tests/012.phpt5
-rw-r--r--ext/spl/spl_array.c2
-rw-r--r--ext/spl/spl_directory.c4
-rw-r--r--ext/spl/spl_iterators.c18
-rw-r--r--ext/spl/tests/array_013.phpt6
-rw-r--r--ext/standard/assert.c4
-rw-r--r--ext/standard/basic_functions.c3
-rw-r--r--ext/standard/html.c2
-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/standard/tests/class_object/forward_static_call_002.phpt7
-rw-r--r--ext/tidy/tidy.c2
-rw-r--r--ext/wddx/wddx.c4
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c2
-rw-r--r--ext/zip/php_zip.c2
54 files changed, 259 insertions, 148 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 5e9c15c19d..d6cff1ad46 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -2787,7 +2787,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");
}
}
/* }}} */
@@ -2809,7 +2809,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");
}
}
/* }}} */
@@ -2827,7 +2827,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");
}
}
/* }}} */
@@ -3699,7 +3699,7 @@ PHP_METHOD(DateTimeZone, __set_state)
HashTable *myht;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "a", &array) == FAILURE) {
- RETURN_FALSE;
+ return;
}
myht = Z_ARRVAL_P(array);
@@ -3707,7 +3707,8 @@ 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) {
- php_error_docref(NULL, E_ERROR, "Timezone initialization failed");
+ zend_throw_error(NULL, "Timezone initialization failed");
+ zval_dtor(return_value);
}
}
/* }}} */
@@ -3725,7 +3726,7 @@ PHP_METHOD(DateTimeZone, __wakeup)
myht = Z_OBJPROP_P(object);
if(php_date_timezone_initialize_from_hash(&return_value, &tzobj, myht) != SUCCESS) {
- php_error_docref(NULL, E_ERROR, "Timezone initialization failed");
+ zend_throw_error(NULL, "Timezone initialization failed");
}
}
/* }}} */
@@ -5006,7 +5007,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");
}
}
/* }}} */
@@ -5024,7 +5025,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");
}
}
/* }}} */
@@ -5034,7 +5035,8 @@ static zval *date_period_read_property(zval *object, zval *member, int type, voi
{
zval *zv;
if (type != BP_VAR_IS && type != BP_VAR_R) {
- php_error_docref(NULL, E_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);
}
Z_OBJPROP_P(object); /* build properties hash table */
@@ -5052,7 +5054,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)
{
- php_error_docref(NULL, E_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.phpt b/ext/date/tests/bug68942.phpt
index a26ce8867b..9a9a5cfb88 100644
--- a/ext/date/tests/bug68942.phpt
+++ b/ext/date/tests/bug68942.phpt
@@ -6,4 +6,9 @@ $data = unserialize('a:2:{i:0;O:12:"DateTimeZone":2:{s:13:"timezone_type";a:2:{i
var_dump($data);
?>
--EXPECTF--
-Fatal error: DateTimeZone::__wakeup(): Timezone initialization failed in %s%ebug68942.php on line %d
+Fatal error: Uncaught Error: Timezone initialization failed in %s:%d
+Stack trace:
+#0 [internal function]: DateTimeZone->__wakeup()
+#1 %s(%d): unserialize('a:2:{i:0;O:12:"...')
+#2 {main}
+ thrown in %s 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/dba/dba.c b/ext/dba/dba.c
index 9e835b0ce9..d4a718bbce 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/dom/document.c b/ext/dom/document.c
index 30d9c13ee9..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;
}
@@ -2244,15 +2244,11 @@ PHP_METHOD(domdocument, registerNodeClass)
if (ce == NULL || instanceof_function(ce, basece)) {
DOM_GET_OBJ(docp, id, xmlDocPtr, intern);
-
- if (dom_set_doc_classmap(intern->document, basece, ce) == FAILURE) {
- php_error_docref(NULL, E_ERROR, "Class %s could not be registered.", ZSTR_VAL(ce->name));
- }
+ dom_set_doc_classmap(intern->document, basece, ce);
RETURN_TRUE;
- } else {
- php_error_docref(NULL, E_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 68a8d3a802..9879d81c1c 100644
--- a/ext/dom/php_dom.c
+++ b/ext/dom/php_dom.c
@@ -206,7 +206,7 @@ static void dom_copy_doc_props(php_libxml_ref_obj *source_doc, php_libxml_ref_ob
}
}
-int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce)
+void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce)
{
dom_doc_propsptr doc_props;
@@ -214,7 +214,7 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece,
doc_props = dom_get_doc_props(document);
if (doc_props->classmap == NULL) {
if (ce == NULL) {
- return SUCCESS;
+ return;
}
ALLOC_HASHTABLE(doc_props->classmap);
zend_hash_init(doc_props->classmap, 0, NULL, NULL, 0);
@@ -225,7 +225,6 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece,
zend_hash_del(doc_props->classmap, basece->name);
}
}
- return SUCCESS;
}
zend_class_entry *dom_get_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece)
@@ -286,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)
{
- php_error_docref(NULL, E_ERROR, "Cannot read property");
+ zend_throw_error(NULL, "Cannot read property");
return FAILURE;
}
/* }}} */
@@ -294,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)
{
- php_error_docref(NULL, E_ERROR, "Cannot write property");
+ zend_throw_error(NULL, "Cannot write property");
return FAILURE;
}
/* }}} */
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index 2c9f1cc656..d0329ac2ed 100644
--- a/ext/dom/php_dom.h
+++ b/ext/dom/php_dom.h
@@ -125,7 +125,7 @@ xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const
xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index);
xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index);
zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref);
-int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
+void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce);
zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv);
int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty);
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index dcad868db4..39d7fbb1ca 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) {
- php_error_docref(NULL, E_ERROR, "Address buffer overflow");
+ zend_throw_error(NULL, "Address buffer overflow");
return NULL;
}
address[0] = 0;
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 7ad8f8fc8c..69629558d1 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/idn/idn.c b/ext/intl/idn/idn.c
index 6e699604df..1489dab9b1 100644
--- a/ext/intl/idn/idn.c
+++ b/ext/intl/idn/idn.c
@@ -165,7 +165,10 @@ static void php_intl_idn_to_46(INTERNAL_FUNCTION_PARAMETERS,
RETURN_FALSE;
}
if (len >= 255) {
- php_error_docref(NULL, E_ERROR, "ICU returned an unexpected length");
+ zend_throw_error(NULL, "ICU returned an unexpected length");
+ uidna_close(uts46);
+ zend_string_free(buffer);
+ RETURN_FALSE;
}
ZSTR_VAL(buffer)[len] = '\0';
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/intl/transliterator/transliterator_class.c b/ext/intl/transliterator/transliterator_class.c
index ba207a021c..beeee41d8e 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 ) );
- php_error_docref( NULL, E_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 60436e5b05..01bdc267e1 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1912,8 +1912,11 @@ PHP_FUNCTION(ldap_modify_batch)
oper = LDAP_MOD_REPLACE;
break;
default:
- php_error_docref(NULL, E_ERROR, "Unknown and uncaught modification type.");
- RETURN_FALSE;
+ zend_throw_error(NULL, "Unknown and uncaught modification type.");
+ RETVAL_FALSE;
+ efree(ldap_mods[i]);
+ num_mods = i;
+ goto cleanup;
}
/* fill in the basic info */
@@ -1958,7 +1961,7 @@ PHP_FUNCTION(ldap_modify_batch)
} else RETVAL_TRUE;
/* clean up */
- {
+ cleanup: {
for (i = 0; i < num_mods; i++) {
/* attribute */
efree(ldap_mods[i]->mod_type);
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 00ae75afaf..5af7eb15c6 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -955,8 +955,11 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
/* do eval */
if (zend_eval_stringl(ZSTR_VAL(eval_str), ZSTR_LEN(eval_str), &v, description) == FAILURE) {
efree(description);
- php_error_docref(NULL,E_ERROR, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_str));
- /* zend_error() does not return in this case */
+ zend_throw_error(NULL, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_str));
+ onig_region_free(regs, 0);
+ smart_str_free(&out_buf);
+ smart_str_free(&eval_buf);
+ RETURN_FALSE;
}
/* result of eval */
diff --git a/ext/mbstring/tests/bug43301.phpt b/ext/mbstring/tests/bug43301.phpt
index 2a5f748c5b..9c629ec38c 100644
--- a/ext/mbstring/tests/bug43301.phpt
+++ b/ext/mbstring/tests/bug43301.phpt
@@ -15,7 +15,14 @@ echo mb_ereg_replace($ptr,'$1',$txt,'e');
?>
--EXPECTF--
-Parse error: syntax error, unexpected %s, expecting %s or '$' in %sbug43301.php(%d) : mbregex replace on line %d
+Fatal error: Uncaught ParseError: syntax error, unexpected '1' (T_LNUMBER), expecting variable (T_VARIABLE) or '{' or '$' in %sbug43301.php(%d) : mbregex replace:1
+Stack trace:
+#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e')
+#1 {main}
-Fatal error: mb_ereg_replace(): Failed evaluating code:
-$1 in %sbug43301.php on line %d
+Next Error: Failed evaluating code:
+$1 in %sbug43301.php:%d
+Stack trace:
+#0 %sbug43301.php(%d): mb_ereg_replace('hello', '$1', 'hello, I have g...', 'e')
+#1 {main}
+ thrown in %sbug43301.php on line %d
diff --git a/ext/mcrypt/mcrypt.c b/ext/mcrypt/mcrypt.c
index 656a77c8bb..86e70d51fb 100644
--- a/ext/mcrypt/mcrypt.c
+++ b/ext/mcrypt/mcrypt.c
@@ -1291,7 +1291,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/mysqli/mysqli.c b/ext/mysqli/mysqli.c
index 8653f99c99..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)
{
- php_error_docref(NULL, E_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)
{
- php_error_docref(NULL, E_ERROR, "Cannot write property");
+ zend_throw_error(NULL, "Cannot write property");
return FAILURE;
}
/* }}} */
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index f470b77400..61f6fcc62b 100644
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -121,7 +121,7 @@ PHP_MINIT_FUNCTION(pdo_odbc)
} else if (*pooling_val == '\0' || strcasecmp(pooling_val, "off") == 0) {
pdo_odbc_pool_on = SQL_CP_OFF;
} else {
- php_error_docref(NULL, E_ERROR, "Error in pdo_odbc.connection_pooling configuration. Value MUST be one of 'strict', 'relaxed' or 'off'");
+ php_error_docref(NULL, E_CORE_ERROR, "Error in pdo_odbc.connection_pooling configuration. Value MUST be one of 'strict', 'relaxed' or 'off'");
return FAILURE;
}
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 6471e4aa2a..ebc34e902d 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -107,7 +107,8 @@ ZEND_DECLARE_MODULE_GLOBALS(reflection)
intern = Z_REFLECTION_P(getThis()); \
if (intern->ptr == NULL) { \
RETURN_ON_EXCEPTION \
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the reflection object"); \
+ zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object"); \
+ return; \
} \
#define GET_REFLECTION_OBJECT_PTR(target) \
@@ -1496,7 +1497,8 @@ static parameter_reference *_reflection_param_get_default_param(INTERNAL_FUNCTIO
if (EG(exception) && EG(exception)->ce == reflection_exception_ptr) {
return NULL;
}
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the reflection object");
+ zend_throw_error(NULL, "Internal error: Failed to retrieve the reflection object");
+ return NULL;
}
param = intern->ptr;
@@ -5186,8 +5188,8 @@ 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) {
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
- /* Bails out */
+ zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
+ return;
}
class_ce = argument->ptr;
break;
@@ -5230,8 +5232,8 @@ ZEND_METHOD(reflection_class, implementsInterface)
if (instanceof_function(Z_OBJCE_P(interface), reflection_class_ptr)) {
argument = Z_REFLECTION_P(interface);
if (argument->ptr == NULL) {
- php_error_docref(NULL, E_ERROR, "Internal error: Failed to retrieve the argument's reflection object");
- /* Bails out */
+ zend_throw_error(NULL, "Internal error: Failed to retrieve the argument's reflection object");
+ return;
}
interface_ce = argument->ptr;
break;
@@ -5631,8 +5633,8 @@ ZEND_METHOD(reflection_property, getValue)
return;
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
- /* Bails out */
+ zend_throw_error(NULL, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
+ return;
}
member_p = &CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset];
ZVAL_DEREF(member_p);
@@ -5698,8 +5700,8 @@ ZEND_METHOD(reflection_property, setValue)
}
if (Z_TYPE(CE_STATIC_MEMBERS(intern->ce)[ref->prop.offset]) == IS_UNDEF) {
- php_error_docref(NULL, E_ERROR, "Internal error: Could not find the property %s::%s", ZSTR_VAL(intern->ce->name), ZSTR_VAL(ref->prop.name));
- /* Bails out */
+ 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];
if (variable_ptr != value) {
diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c
index c7c09ff781..beddce8883 100644
--- a/ext/session/mod_user.c
+++ b/ext/session/mod_user.c
@@ -200,12 +200,12 @@ PS_CREATE_SID_FUNC(user)
}
zval_ptr_dtor(&retval);
} else {
- php_error_docref(NULL, E_ERROR, "No session id returned by function");
+ zend_throw_error(NULL, "No session id returned by function");
return NULL;
}
if (!id) {
- php_error_docref(NULL, E_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 50ae0f8849..d85d72b2a6 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -348,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);
- php_error_docref(NULL, E_ERROR, "Invalid session hash function");
+ zend_throw_error(NULL, "Invalid session hash function");
return NULL;
}
@@ -360,7 +360,7 @@ PHPAPI zend_string *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
#endif /* HAVE_HASH_EXT */
default:
efree(buf);
- php_error_docref(NULL, E_ERROR, "Invalid session hash function");
+ zend_throw_error(NULL, "Invalid session hash function");
return NULL;
}
efree(buf);
@@ -529,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();
- php_error_docref(NULL, E_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)) {
@@ -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/session/tests/session_save_path_variation4.phpt b/ext/session/tests/session_save_path_variation4.phpt
index 80db6caf7d..a4c4e995d3 100644
--- a/ext/session/tests/session_save_path_variation4.phpt
+++ b/ext/session/tests/session_save_path_variation4.phpt
@@ -57,4 +57,3 @@ string(0) ""
Warning: session_start(): open_basedir restriction in effect. File(%s) is not within the allowed path(s): (.) in %s on line %d
Fatal error: session_start(): Failed to initialize storage module: files (path: ) in %s on line %d
-
diff --git a/ext/session/tests/session_set_save_handler_sid_002.phpt b/ext/session/tests/session_set_save_handler_sid_002.phpt
index f9a72aebca..1d00586e89 100644
--- a/ext/session/tests/session_set_save_handler_sid_002.phpt
+++ b/ext/session/tests/session_set_save_handler_sid_002.phpt
@@ -74,4 +74,13 @@ session_unset();
--EXPECTF--
*** Testing session_set_save_handler() function: create_sid ***
-Fatal error: session_start(): Session id must be a string in %s on line %d
+Fatal error: Uncaught Error: Session id must be a string in %s:%d
+Stack trace:
+#0 %s(%d): session_start()
+#1 {main}
+
+Next Error: Failed to create session ID: user (path: ) in %s:%d
+Stack trace:
+#0 %s(%d): session_start()
+#1 {main}
+ thrown in %s on line %d
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 5c163b6d41..8685934d4f 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -250,8 +250,8 @@ 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 */
- php_error_docref(NULL, E_ERROR, "Cannot create unnamed attribute");
- return NULL;
+ zend_throw_error(NULL, "Cannot create unnamed attribute");
+ return &EG(uninitialized_zval);
}
name = NULL;
} else {
@@ -277,8 +277,8 @@ 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 */
- php_error_docref(NULL, E_ERROR, "Cannot create unnamed attribute");
- return NULL;
+ 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.
*/
- php_error_docref(NULL, E_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.
*/
- php_error_docref(NULL, E_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,10 @@ 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) {
- php_error_docref(NULL, E_ERROR, "Cannot create duplicate attribute");
+ zend_throw_error(NULL, "Cannot create duplicate attribute");
+ if (new_value) {
+ zval_ptr_dtor(value);
+ }
return FAILURE;
}
diff --git a/ext/simplexml/tests/012.phpt b/ext/simplexml/tests/012.phpt
index 2fc9bec41e..abbb10b8d3 100644
--- a/ext/simplexml/tests/012.phpt
+++ b/ext/simplexml/tests/012.phpt
@@ -37,4 +37,7 @@ Warning: main(): Cannot write or create unnamed attribute in %s012.php on line %
<?xml version="1.0" encoding="ISO-8859-1"?>
<foo attr="new value"/>
-Fatal error: main(): Cannot create unnamed attribute in %s012.php on line %d
+Fatal error: Uncaught Error: Cannot create unnamed attribute in %s012.php:%d
+Stack trace:
+#0 {main}
+ thrown in %s012.php on line %d
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 3b9188a71c..4c40c84fc4 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/spl_directory.c b/ext/spl/spl_directory.c
index 2639065286..3b6de66a0c 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -355,8 +355,8 @@ static zend_object *spl_filesystem_object_clone(zval *zobject)
intern->u.dir.index = index;
break;
case SPL_FS_FILE:
- php_error_docref(NULL, E_ERROR, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name));
- break;
+ zend_throw_error(NULL, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name));
+ return NULL;
}
intern->file_class = source->file_class;
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 3d610e9bd7..80255d6a35 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1394,10 +1394,6 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
intern = Z_SPLDUAL_IT_P(getThis());
ZVAL_STRING(&func, method, 0);
- if (!zend_is_callable(&func, 0, &method)) {
- php_error_docref(NULL, E_ERROR, "Method %s::%s() does not exist", intern->inner.ce->name, method);
- return FAILURE;
- }
p = EG(argument_stack).top_element-2;
arg_count = (zend_ulong) *p;
@@ -1416,7 +1412,7 @@ int spl_dual_it_call_method(char *method, INTERNAL_FUNCTION_PARAMETERS)
success = SUCCESS;
} else {
- php_error_docref(NULL, E_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;
}
@@ -1644,13 +1640,6 @@ SPL_METHOD(dual_it, getInnerIterator)
}
} /* }}} */
-static inline void spl_dual_it_require(spl_dual_it_object *intern)
-{
- if (!intern->inner.iterator) {
- php_error_docref(NULL, E_ERROR, "The inner constructor wasn't initialized with an iterator instance");
- }
-}
-
static inline void spl_dual_it_free(spl_dual_it_object *intern)
{
if (intern->inner.iterator && intern->inner.iterator->funcs->invalidate_current) {
@@ -1723,8 +1712,9 @@ static inline void spl_dual_it_next(spl_dual_it_object *intern, int do_free)
{
if (do_free) {
spl_dual_it_free(intern);
- } else {
- spl_dual_it_require(intern);
+ } else if (!intern->inner.iterator) {
+ zend_throw_error(NULL, "The inner constructor wasn't initialized with an iterator instance");
+ return;
}
intern->inner.iterator->funcs->move_forward(intern->inner.iterator);
intern->current.pos++;
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 f66e343f98..fe04f329e2 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/basic_functions.c b/ext/standard/basic_functions.c
index 55e1f7e2eb..47dbc3d9ac 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -4855,7 +4855,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 ae248dd12b..e8657365b3 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/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c
index dbd0a3fba1..398bd0a9ae 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/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 c5d43b097b..0537c576c7 100644
--- a/ext/tidy/tidy.c
+++ b/ext/tidy/tidy.c
@@ -1849,7 +1849,7 @@ static TIDY_NODE_METHOD(getParent)
__constructor for tidyNode. */
static TIDY_NODE_METHOD(__construct)
{
- php_error_docref(NULL, E_ERROR, "You should not create a tidyNode manually");
+ zend_throw_error(NULL, "You should not create a tidyNode manually");
}
/* }}} */
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index f0869282f1..13e48ff3a6 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++;
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index f42cdf0c16..a8ab7808e8 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -557,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) {
- php_error_docref(NULL, E_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 9bb4b524de..484724aef6 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -589,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
- php_error_docref(NULL, E_ERROR, "Glob support is not available");
+ zend_throw_error(NULL, "Glob support is not available");
return 0;
#endif /* HAVE_GLOB */
}