mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Update memory freeing and other issues, revert some changes
This commit is contained in:
parent
907476f34c
commit
7ec1e17464
16 changed files with 33 additions and 56 deletions
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
Fatal error: session_start(): Failed to initialize storage module: %s in %ssession_set_save_handler_error3.php on line %d
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue