1
0
mirror of https://github.com/php/php-src.git synced 2026-04-20 14:31:06 +02:00

Merge branch 'phpng' of git.php.net:php-src into phpng

* 'phpng' of git.php.net:php-src:
  Fixed getDefaultProperties (it should not return reference)
  Fixed invalid free
  Fixed segfault
This commit is contained in:
Dmitry Stogov
2014-07-31 10:55:39 +04:00
2 changed files with 3 additions and 13 deletions

View File

@@ -287,7 +287,6 @@ PHP_FUNCTION(ibase_set_event_handler)
* No more than 15 events
*/
if (ZEND_NUM_ARGS() < 3 || ZEND_NUM_ARGS() > 17) {
efree(args);
WRONG_PARAM_COUNT;
}
@@ -295,7 +294,6 @@ PHP_FUNCTION(ibase_set_event_handler)
i = 2;
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link, ibase_db_link *, &args[0], -1, "InterBase link", le_link, le_plink)) {
efree(args);
RETURN_FALSE;
}
@@ -307,14 +305,12 @@ PHP_FUNCTION(ibase_set_event_handler)
* No more than 15 events
*/
if (ZEND_NUM_ARGS() < 2 || ZEND_NUM_ARGS() > 16) {
efree(args);
WRONG_PARAM_COUNT;
}
cb_arg = &args[0];
if (!ZEND_FETCH_RESOURCE2_NO_RETURN(ib_link, ibase_db_link *, NULL, IBG(default_link), "InterBase link", le_link, le_plink)) {
efree(args);
RETURN_FALSE;
}
link_res_id = IBG(default_link);
@@ -324,7 +320,6 @@ PHP_FUNCTION(ibase_set_event_handler)
if (!zend_is_callable(cb_arg, 0, &cb_name TSRMLS_CC)) {
_php_ibase_module_error("Callback argument %s is not a callable function" TSRMLS_CC, cb_name->val);
STR_RELEASE(cb_name);
efree(args);
RETURN_FALSE;
}
STR_RELEASE(cb_name);
@@ -355,7 +350,6 @@ PHP_FUNCTION(ibase_set_event_handler)
_php_ibase_error(TSRMLS_C);
efree(event);
efree(args);
RETURN_FALSE;
}
@@ -364,7 +358,6 @@ PHP_FUNCTION(ibase_set_event_handler)
ZEND_REGISTER_RESOURCE(return_value, event, le_event);
Z_ADDREF_P(return_value);
efree(args);
}
/* }}} */

View File

@@ -3351,16 +3351,12 @@ ZEND_METHOD(reflection_class, __construct)
/* {{{ add_class_vars */
static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value TSRMLS_DC)
{
HashPosition pos;
zend_property_info *prop_info;
zval *prop, prop_copy;
zend_string *key;
ulong num_index;
zend_hash_internal_pointer_reset_ex(&ce->properties_info, &pos);
while ((prop_info = zend_hash_get_current_data_ptr_ex(&ce->properties_info, &pos)) != NULL) {
zend_hash_get_current_key_ex(&ce->properties_info, &key, &num_index, 0, &pos);
zend_hash_move_forward_ex(&ce->properties_info, &pos);
ZEND_HASH_FOREACH_KEY_PTR(&ce->properties_info, num_index, key, prop_info) {
if (((prop_info->flags & ZEND_ACC_SHADOW) &&
prop_info->ce != ce) ||
((prop_info->flags & ZEND_ACC_PROTECTED) &&
@@ -3382,6 +3378,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
}
/* copy: enforce read only access */
ZVAL_DEREF(prop);
ZVAL_DUP(&prop_copy, prop);
/* this is necessary to make it able to work with default array
@@ -3391,7 +3388,7 @@ static void add_class_vars(zend_class_entry *ce, int statics, zval *return_value
}
zend_hash_update(Z_ARRVAL_P(return_value), key, &prop_copy);
}
} ZEND_HASH_FOREACH_END();
}
/* }}} */