diff options
author | Aaron Piotrowski <aaron@trowski.com> | 2015-07-05 02:37:49 -0500 |
---|---|---|
committer | Aaron Piotrowski <aaron@trowski.com> | 2015-07-05 12:16:57 -0500 |
commit | 907476f34c0dbe34e311c4a99cc07eb40fd2954b (patch) | |
tree | 58c26abe27284c5c221182161cb89fdc90cadc1e /ext/simplexml | |
parent | 550bbf8f4614a5c868010195f562be3e9ee6bb00 (diff) | |
download | php-git-907476f34c0dbe34e311c4a99cc07eb40fd2954b.tar.gz |
Convert E_ERROR to thrown Error in extensions
Diffstat (limited to 'ext/simplexml')
-rw-r--r-- | ext/simplexml/simplexml.c | 10 | ||||
-rw-r--r-- | ext/simplexml/tests/012.phpt | 5 |
2 files changed, 9 insertions, 6 deletions
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c index a54362fe4b..bcc77134c4 100644 --- a/ext/simplexml/simplexml.c +++ b/ext/simplexml/simplexml.c @@ -250,7 +250,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z elements = 1; } else if (!member) { /* This happens when the user did: $sxe[]->foo = $value */ - php_error_docref(NULL, E_ERROR, "Cannot create unnamed attribute"); + zend_throw_error(zend_ce_error, "Cannot create unnamed attribute"); return NULL; } 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 */ - php_error_docref(NULL, E_ERROR, "Cannot create unnamed attribute"); + zend_throw_error(zend_ce_error, "Cannot create unnamed attribute"); return NULL; } } @@ -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(zend_ce_error, "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(zend_ce_error, "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) { - php_error_docref(NULL, E_ERROR, "Cannot create duplicate attribute"); + zend_throw_error(zend_ce_error, "Cannot create duplicate attribute"); 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 |