diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2007-06-24 17:37:01 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2007-06-24 17:37:01 +0000 |
commit | 67a2cca930785936488a586ae3081da3cc2eb871 (patch) | |
tree | c3e3cc766ac585275feae813d0e5175c4ee65c11 | |
parent | 7f47814c4e7f573df27ed7bdd13da75deaa84dc1 (diff) | |
download | php-git-67a2cca930785936488a586ae3081da3cc2eb871.tar.gz |
Fixed bug #41685 (array_push() fails to warn when next index is already
occupied).
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | ext/standard/array.c | 6 |
2 files changed, 7 insertions, 1 deletions
@@ -43,6 +43,8 @@ PHP NEWS - Fixed bug #41717 (imagepolygon does not respect thickness). (Pierre) - Fixed bug #41686 (Omitting length param in array_slice not possible). (Ilia) +- Fixed bug #41685 (array_push() fails to warn when next index is already + occupied). (Ilia) - Fixed bug #41655 (open_basedir bypass via glob()). (Ilia) - Fixed bug #41640 (get_class_vars produces error on class constants). (Johannes) diff --git a/ext/standard/array.c b/ext/standard/array.c index b698ead1ee..3ac7a2ae75 100644 --- a/ext/standard/array.c +++ b/ext/standard/array.c @@ -1957,7 +1957,11 @@ PHP_FUNCTION(array_push) new_var = *args[i]; new_var->refcount++; - zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL); + if (zend_hash_next_index_insert(Z_ARRVAL_P(stack), &new_var, sizeof(zval *), NULL) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot add element to the array as the next element is already occupied"); + efree(args); + RETURN_FALSE; + } } /* Clean up and return the number of values in the stack */ |