summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/date/php_date.c3
-rw-r--r--ext/dom/document.c12
-rw-r--r--ext/dom/php_dom.c5
-rw-r--r--ext/dom/php_dom.h2
-rw-r--r--ext/ldap/ldap.c2
-rw-r--r--ext/mbstring/php_mbregex.c4
-rw-r--r--ext/pdo_odbc/pdo_odbc.c3
-rw-r--r--ext/session/session.c6
-rw-r--r--ext/session/tests/bug60860.phpt10
-rw-r--r--ext/session/tests/session_module_name_variation3.phpt9
-rw-r--r--ext/session/tests/session_save_path_variation4.phpt6
-rw-r--r--ext/session/tests/session_set_save_handler_error3.phpt9
-rw-r--r--ext/simplexml/simplexml.c7
-rw-r--r--ext/spl/spl_array.c5
-rw-r--r--ext/spl/spl_directory.c2
-rw-r--r--ext/spl/spl_iterators.c4
16 files changed, 33 insertions, 56 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index fbb142b66d..36c965b79d 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3701,6 +3701,7 @@ PHP_METHOD(DateTimeZone, __set_state)
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");
+ zval_dtor(return_value);
RETURN_FALSE;
}
}
@@ -5019,7 +5020,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");
- return NULL;
+ return &EG(uninitialized_zval);
}
Z_OBJPROP_P(object); /* build properties hash table */
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 4a6c178d71..288075c079 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -2221,17 +2221,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) {
- zend_throw_error(zend_ce_error, "Class %s could not be registered.", ZSTR_VAL(ce->name));
- RETURN_FALSE;
- }
+ dom_set_doc_classmap(intern->document, basece, ce);
RETURN_TRUE;
- } else {
- zend_throw_error(zend_ce_error, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name));
- RETURN_FALSE;
}
-
+
+ zend_throw_error(zend_ce_error, "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 517d645e74..6cb198db57 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)
diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h
index fdba616363..5e069529ba 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/ldap/ldap.c b/ext/ldap/ldap.c
index 57d12ece80..f279b7e1fd 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -1824,6 +1824,8 @@ PHP_FUNCTION(ldap_modify_batch)
default:
zend_throw_error(zend_ce_error, "Unknown and uncaught modification type.");
RETVAL_FALSE;
+ efree(ldap_mods[i]);
+ num_mods = i;
goto cleanup;
}
diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c
index 8f548fad4c..1423a6ffa6 100644
--- a/ext/mbstring/php_mbregex.c
+++ b/ext/mbstring/php_mbregex.c
@@ -946,7 +946,9 @@ static void _php_mb_regex_ereg_replace_exec(INTERNAL_FUNCTION_PARAMETERS, OnigOp
efree(description);
zend_throw_error(zend_ce_error, "Failed evaluating code: %s%s", PHP_EOL, ZSTR_VAL(eval_buf.s));
onig_region_free(regs, 0);
- RETVAL_EMPTY_STRING();
+ smart_str_free(&out_buf);
+ smart_str_free(&eval_buf);
+ RETURN_FALSE;
}
/* result of eval */
diff --git a/ext/pdo_odbc/pdo_odbc.c b/ext/pdo_odbc/pdo_odbc.c
index 515e22436f..aa40462da4 100644
--- a/ext/pdo_odbc/pdo_odbc.c
+++ b/ext/pdo_odbc/pdo_odbc.c
@@ -24,7 +24,6 @@
#include "php.h"
#include "php_ini.h"
-#include "zend_exceptions.h"
#include "ext/standard/info.h"
#include "pdo/php_pdo.h"
#include "pdo/php_pdo_driver.h"
@@ -124,7 +123,7 @@ PHP_MINIT_FUNCTION(pdo_odbc)
} else if (*pooling_val == '\0' || strcasecmp(pooling_val, "off") == 0) {
pdo_odbc_pool_on = SQL_CP_OFF;
} else {
- zend_throw_error(zend_ce_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/session/session.c b/ext/session/session.c
index e77aee9574..7baec3255d 100644
--- a/ext/session/session.c
+++ b/ext/session/session.c
@@ -481,7 +481,7 @@ static void php_session_initialize(void) /* {{{ */
zend_string *val = NULL;
if (!PS(mod)) {
- zend_throw_error(zend_ce_error, "No storage module chosen - failed to initialize session");
+ php_error_docref(NULL, E_ERROR, "No storage module chosen - failed to initialize session");
return;
}
@@ -489,7 +489,7 @@ static void php_session_initialize(void) /* {{{ */
if (PS(mod)->s_open(&PS(mod_data), PS(save_path), PS(session_name)) == FAILURE
/* || PS(mod_data) == NULL */ /* FIXME: open must set valid PS(mod_data) with success */
) {
- zend_throw_error(zend_ce_error, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
+ php_error_docref(NULL, E_ERROR, "Failed to initialize storage module: %s (path: %s)", PS(mod)->s_name, PS(save_path));
return;
}
@@ -1830,7 +1830,7 @@ static PHP_FUNCTION(session_set_save_handler)
add_next_index_zval(&PS(mod_user_names).names[i], obj);
add_next_index_str(&PS(mod_user_names).names[i], zend_string_copy(func_name));
} else {
- zend_throw_error(zend_ce_error, "Session handler's function table is corrupt");
+ php_error_docref(NULL, E_ERROR, "Session handler's function table is corrupt");
RETURN_FALSE;
}
diff --git a/ext/session/tests/bug60860.phpt b/ext/session/tests/bug60860.phpt
index ddcd9803db..83185862f0 100644
--- a/ext/session/tests/bug60860.phpt
+++ b/ext/session/tests/bug60860.phpt
@@ -12,12 +12,6 @@ echo "ok\n";
?>
--EXPECTF--
-Warning: session_start(): user session functions not defined in %s on line %d
+Warning: session_start(): user session functions not defined in %s on line 3
-Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at %s:%d) in %s on line %d
-
-Fatal error: Uncaught Error: Failed to initialize storage module: user (path: ) in %s:%d
-Stack trace:
-#0 %s(%d): session_start()
-#1 {main}
- thrown in %s on line %d
+Fatal error: session_start(): Failed to initialize storage module: user (path:%s) in %s on line 3
diff --git a/ext/session/tests/session_module_name_variation3.phpt b/ext/session/tests/session_module_name_variation3.phpt
index 241f53225d..de49195fe8 100644
--- a/ext/session/tests/session_module_name_variation3.phpt
+++ b/ext/session/tests/session_module_name_variation3.phpt
@@ -41,14 +41,11 @@ ob_end_flush();
string(%d) "%s"
string(4) "user"
-Fatal error: Uncaught Exception: Stop...! in %s:%d
+Warning: Uncaught Exception: Stop...! in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
#1 %s(%d): session_start()
#2 {main}
-
-Next Error: Failed to initialize storage module: user (path: ) in %s:%d
-Stack trace:
-#0 %s(%d): session_start()
-#1 {main}
thrown in %s on line %d
+
+Fatal error: session_start(): Failed to initialize storage module: %s in %s%esession_module_name_variation3.php on line %d
diff --git a/ext/session/tests/session_save_path_variation4.phpt b/ext/session/tests/session_save_path_variation4.phpt
index ce949d807c..a4c4e995d3 100644
--- a/ext/session/tests/session_save_path_variation4.phpt
+++ b/ext/session/tests/session_save_path_variation4.phpt
@@ -56,8 +56,4 @@ 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: Uncaught Error: Failed to initialize storage module: files (path: ) in %s:%d
-Stack trace:
-#0 %s(%d): session_start()
-#1 {main}
- thrown 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_error3.phpt b/ext/session/tests/session_set_save_handler_error3.phpt
index cc1fe3934d..fdf306a4a5 100644
--- a/ext/session/tests/session_set_save_handler_error3.phpt
+++ b/ext/session/tests/session_set_save_handler_error3.phpt
@@ -34,14 +34,11 @@ ob_end_flush();
--EXPECTF--
*** Testing session_set_save_handler() : error functionality ***
-Fatal error: Uncaught Exception: Do something bad..! in %s:%d
+Warning: Uncaught Exception: Do something bad..! in %s:%d
Stack trace:
#0 [internal function]: open('', 'PHPSESSID')
#1 %s(%d): session_start()
#2 {main}
+ thrown in %s on line %d
-Next Error: Failed to initialize storage module: user (path: ) in %s:%d
-Stack trace:
-#0 %s(%d): session_start()
-#1 {main}
- thrown in %s on line %d \ No newline at end of file
+Fatal error: session_start(): Failed to initialize storage module: %s in %ssession_set_save_handler_error3.php on line %d
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index bcc77134c4..c047d7e235 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -251,7 +251,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
} else if (!member) {
/* This happens when the user did: $sxe[]->foo = $value */
zend_throw_error(zend_ce_error, "Cannot create unnamed attribute");
- return NULL;
+ return &EG(uninitialized_zval);
}
name = NULL;
} else {
@@ -278,7 +278,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
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");
- return NULL;
+ return &EG(uninitialized_zval);
}
}
@@ -572,6 +572,9 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
if (!member || Z_TYPE_P(member) == IS_LONG) {
if (node->type == XML_ATTRIBUTE_NODE) {
zend_throw_error(zend_ce_error, "Cannot create duplicate attribute");
+ if (new_value) {
+ zval_ptr_dtor(value);
+ }
return FAILURE;
}
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 44f201d9b9..2835876e33 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -787,10 +787,7 @@ static HashTable *spl_array_get_properties(zval *object) /* {{{ */
HashTable *result;
if (intern->nApplyCount > 1) {
- zend_throw_error(zend_ce_error, "Nesting level too deep - recursive dependency?");
- ALLOC_HASHTABLE(result);
- ZEND_INIT_SYMTABLE(result);
- return result;
+ php_error_docref(NULL, E_ERROR, "Nesting level too deep - recursive dependency?");
}
intern->nApplyCount++;
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 45803b311c..88026efaf8 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -196,7 +196,7 @@ static inline void spl_filesystem_object_get_file_name(spl_filesystem_object *in
case SPL_FS_INFO:
case SPL_FS_FILE:
if (!intern->file_name) {
- zend_throw_error(zend_ce_error, "Object not initialized");
+ php_error_docref(NULL, E_ERROR, "Object not initialized");
}
break;
case SPL_FS_DIR:
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index fe837307ba..0f99923492 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1391,10 +1391,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)) {
- zend_throw_error(zend_ce_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;