Commit a88a88d0 authored by Mark A. Hershberger's avatar Mark A. Hershberger

Imported Upstream version 5.1.6

parent ba500317
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
17 Aug 2006, PHP 5.1.5
24 Aug 2006, PHP 5.1.6
- Fixed memory_limit on 64bit systems. (Stefan E.)
- Fixed bug #38488 (Access to "php://stdin" and family crashes PHP on win32).
(Dmitry)
17 Aug 2006, PHP 5.1.5
- Fixed overflow on 64bit systems in str_repeat() and wordwrap(). (Stefan E.)
- Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are
enabled. (Stefan E., Ilia)
......
dnl $Id: acinclude.m4,v 1.15.2.2 2005/11/01 10:31:56 sebastian Exp $
dnl $Id: acinclude.m4,v 1.15.2.4 2006/08/04 06:48:59 derick Exp $
dnl
dnl This file contains local autoconf functions.
AC_DEFUN([LIBZEND_BISON_CHECK],[
# we only support certain bison versions
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1"
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1 2.2 2.3"
# for standalone build of Zend Engine
test -z "$SED" && SED=sed
......
--TEST--
Test for abstract static classes
--FILE--
<?php
abstract class ezcDbHandler extends PDO
{
public function __construct( $dbParams, $dsn )
{
$user = null;
$pass = null;
$driverOptions = null;
}
abstract static public function getName();
static public function hasFeature( $feature )
{
return false;
}
}
?>
DONE
--EXPECT--
DONE
--TEST--
bug #34873 (Segmentation Fault on foreach in object)
Bug #34873 (Segmentation Fault on foreach in object)
--FILE--
<?php
class pwa {
......
--TEST--
Bug #36513 (comment will be outputed in last line)
--FILE--
<?php
function test($s) {
echo "'".trim(str_replace("&nbsp;", " ", htmlspecialchars_decode(strip_tags(highlight_string($s,1)))))."'\n";
}
eval('echo "1";//2');
eval('echo 3; //{ 4?>5');
echo "\n";
//test('<?php echo "1";//');
test('<?php echo "1";//2');
test('<?php echo "1";//22');
test('<?php echo 3; // 4 ?>5');
?>
--EXPECT--
135
'<?php echo "1";//2'
'<?php echo "1";//22'
'<?php echo 3; // 4 ?>5'
--TEST--
Bug #37046 (foreach breaks static scope)
--FILE--
<?php
function s() {
static $storage = array(array('x', 'y'));
return $storage[0];
}
foreach (s() as $k => $function) {
echo "op1 $k\n";
if ($k == 0) {
foreach (s() as $k => $function) {
echo "op2 $k\n";
}
}
}
?>
--EXPECT--
op1 0
op2 0
op2 1
op1 1
--TEST--
Bug #37138 (__autoload tries to load callback'ed self and parent)
--FILE--
<?php
function __autoload ($CN) {var_dump ($CN);}
class st {
public static function e () {echo ("EHLO\n");}
public static function e2 () {call_user_func (array ('self', 'e'));}
}
class stch extends st {
public static function g () {call_user_func (array ('parent', 'e'));}
}
st::e ();
st::e2 ();
stch::g ();
?>
--EXPECT--
EHLO
EHLO
EHLO
--TEST--
Test whether an object is NULL or not.
--FILE--
<?php
class Bla
{
}
$b = new Bla;
var_dump($b != null);
var_dump($b == null);
var_dump($b !== null);
var_dump($b === null);
?>
--EXPECT--
bool(true)
bool(false)
bool(true)
bool(false)
......@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_API.c,v 1.296.2.26 2006/03/23 13:14:55 helly Exp $ */
/* $Id: zend_API.c,v 1.296.2.27 2006/04/20 07:30:38 dmitry Exp $ */
#include "zend.h"
#include "zend_execute.h"
......@@ -2039,18 +2039,16 @@ static int zend_is_callable_check_func(int check_flags, zval ***zobj_ptr_ptr, ze
if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
clen = colon - Z_STRVAL_P(callable);
mlen = Z_STRLEN_P(callable) - clen - 2;
if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
/* caution: lcname is not '\0' terminated */
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
*ce_ptr = EG(scope);
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
*ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
} else if (zend_lookup_class(Z_STRVAL_P(callable), clen, &pce TSRMLS_CC) == SUCCESS) {
*ce_ptr = *pce;
} else {
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), clen);
/* caution: lcname is not '\0' terminated */
if (clen == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self") - 1) == 0) {
*ce_ptr = EG(scope);
} else if (clen == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent") - 1) == 0 && EG(active_op_array)->scope) {
*ce_ptr = EG(scope) ? EG(scope)->parent : NULL;
}
efree(lcname);
}
efree(lcname);
if (!*ce_ptr) {
return 0;
}
......@@ -2179,17 +2177,15 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
return 1;
}
if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
ce = EG(active_op_array)->scope;
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
} else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
} else if (EG(active_op_array)) {
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
ce = EG(active_op_array)->scope;
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
}
efree(lcname);
}
efree(lcname);
} else {
ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_alloc.c,v 1.144.2.3 2006/01/04 23:53:03 andi Exp $ */
/* $Id: zend_alloc.c,v 1.144.2.4 2006/08/10 17:16:24 iliaa Exp $ */
#include "zend.h"
#include "zend_alloc.h"
......@@ -72,7 +72,15 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
#define CHECK_MEMORY_LIMIT(s, rs) _CHECK_MEMORY_LIMIT(s, rs, NULL, 0)
# endif
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { if ((ssize_t)(rs) > (ssize_t)(INT_MAX - AG(allocated_memory))) { \
if (file) { \
fprintf(stderr, "Integer overflow in memory_limit check detected at %s:%d\n", file, lineno); \
} else { \
fprintf(stderr, "Integer overflow in memory_limit check detected\n"); \
} \
exit(1); \
} \
AG(allocated_memory) += rs;\
if (AG(memory_limit)<AG(allocated_memory)) {\
int php_mem_limit = AG(memory_limit); \
AG(allocated_memory) -= rs; \
......@@ -127,7 +135,7 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
#endif
#define DECLARE_CACHE_VARS() \
unsigned int real_size; \
size_t real_size; \
unsigned int cache_index
#define REAL_SIZE(size) ((size+7) & ~0x7)
......@@ -142,12 +150,16 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
{
zend_mem_header *p;
zend_mem_header *p = NULL;
DECLARE_CACHE_VARS();
TSRMLS_FETCH();
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
if (size > INT_MAX || SIZE < size) {
goto emalloc_error;
}
#if !ZEND_DISABLE_MEMORY_CACHE
if ((CACHE_INDEX < MAX_CACHED_MEMORY) && (AG(cache_count)[CACHE_INDEX] > 0)) {
p = AG(cache)[CACHE_INDEX][--AG(cache_count)[CACHE_INDEX]];
......@@ -184,6 +196,8 @@ ZEND_API void *_emalloc(size_t size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
}
#endif
emalloc_error:
HANDLE_BLOCK_INTERRUPTIONS();
if (!p) {
......@@ -357,6 +371,13 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
CALCULATE_REAL_SIZE_AND_CACHE_INDEX(size);
HANDLE_BLOCK_INTERRUPTIONS();
if (size > INT_MAX || SIZE < size) {
REMOVE_POINTER_FROM_LIST(p);
p = NULL;
goto erealloc_error;
}
#if MEMORY_LIMIT
CHECK_MEMORY_LIMIT(size - p->size, SIZE - REAL_SIZE(p->size));
if (AG(allocated_memory) > AG(allocated_memory_peak)) {
......@@ -365,6 +386,7 @@ ZEND_API void *_erealloc(void *ptr, size_t size, int allow_failure ZEND_FILE_LIN
#endif
REMOVE_POINTER_FROM_LIST(p);
p = (zend_mem_header *) ZEND_DO_REALLOC(p, sizeof(zend_mem_header)+MEM_HEADER_PADDING+SIZE+END_MAGIC_SIZE);
erealloc_error:
if (!p) {
if (!allow_failure) {
fprintf(stderr,"FATAL: erealloc(): Unable to allocate %ld bytes\n", (long) size);
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_compile.c,v 1.647.2.25 2006/03/27 08:09:18 dmitry Exp $ */
/* $Id: zend_compile.c,v 1.647.2.27 2006/05/02 15:49:26 dmitry Exp $ */
#include <zend_language_parser.h>
#include "zend.h"
......@@ -154,6 +154,7 @@ void zend_init_compiler_data_structures(TSRMLS_D)
void init_compiler(TSRMLS_D)
{
CG(active_op_array) = NULL;
zend_init_compiler_data_structures(TSRMLS_C);
zend_init_rsrc_list(TSRMLS_C);
zend_hash_init(&CG(filenames_table), 5, NULL, (dtor_func_t) free_estring, 0);
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_execute_API.c,v 1.331.2.19 2006/03/17 08:47:41 dmitry Exp $ */
/* $Id: zend_execute_API.c,v 1.331.2.20 2006/04/20 22:49:20 tony2001 Exp $ */
#include <stdio.h>
#include <signal.h>
......@@ -819,7 +819,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
if (EX(function_state).function->common.fn_flags & (ZEND_ACC_ABSTRACT|ZEND_ACC_DEPRECATED)) {
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %v::%v()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
}
if (EX(function_state).function->common.fn_flags & ZEND_ACC_DEPRECATED) {
zend_error(E_STRICT, "Function %s%s%s() is deprecated",
......
This diff is collapsed.
This diff is collapsed.
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_ini_parser.y,v 1.41.2.1 2006/01/04 23:53:04 andi Exp $ */
/* $Id: zend_ini_parser.y,v 1.41.2.2 2006/04/12 09:51:54 dmitry Exp $ */
#define DEBUG_CFG_PARSER 0
#include "zend.h"
......@@ -249,25 +249,26 @@ string_or_value:
expr { $$ = $1; }
| CFG_TRUE { $$ = $1; }
| CFG_FALSE { $$ = $1; }
| var_string_list { $$ = $1; }
| '\n' { zend_ini_init_string(&$$); }
| /* empty */ { zend_ini_init_string(&$$); }
;
var_string_list:
var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
cfg_var_ref { $$ = $1; }
| TC_ENCAPSULATED_STRING { $$ = $1; }
| constant_string { $$ = $1; }
| var_string_list cfg_var_ref { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
| var_string_list TC_ENCAPSULATED_STRING { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); }
| /* empty */ { zend_ini_init_string(&$$); }
| var_string_list constant_string { zend_ini_add_string(&$$, &$1, &$2); free($2.value.str.val); }
;
cfg_var_ref:
TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); }
TC_DOLLAR_CURLY TC_STRING '}' { zend_ini_get_var(&$$, &$2); free($2.value.str.val); }
;
expr:
constant_string { $$ = $1; }
var_string_list { $$ = $1; }
| expr '|' expr { zend_ini_do_op('|', &$$, &$1, &$3); }
| expr '&' expr { zend_ini_do_op('&', &$$, &$1, &$3); }
| '~' expr { zend_ini_do_op('~', &$$, &$2, NULL); }
......
......@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_interfaces.c,v 1.33.2.3 2006/02/26 10:53:38 helly Exp $ */
/* $Id: zend_interfaces.c,v 1.33.2.4 2006/04/10 22:49:29 helly Exp $ */
#include "zend.h"
#include "zend_API.h"
......@@ -287,7 +287,7 @@ static zend_object_iterator *zend_user_it_get_new_iterator(zend_class_entry *ce,
if (!ce || !ce_it || !ce_it->get_iterator || (ce_it->get_iterator == zend_user_it_get_new_iterator && iterator == object)) {
if (!EG(exception))
{
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce->name);
zend_throw_exception_ex(NULL, 0 TSRMLS_CC, "Objects returned by %s::getIterator() must be traversable or implement interface Iterator", ce ? ce->name : Z_OBJCE_P(object)->name);
}
if (iterator)
{
......
......@@ -372,7 +372,7 @@ static yyconst short int yy_accept[1411] =
145, 159, 118, 142, 145, 141, 158, 159, 143, 159,
157, 155, 140, 159, 118, 38, 37, 101, 100, 127,
130, 130, 160, 123, 123, 121, 121, 121, 111, 0,
130, 130, 122, 122, 122, 121, 121, 121, 111, 0,
111, 114, 112, 111, 119, 75, 0, 133, 0, 116,
83, 132, 90, 86, 0, 134, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 80, 70, 78,
......@@ -2699,7 +2699,7 @@ char *yytext;
+----------------------------------------------------------------------+
*/
/* $Id: zend_language_scanner.l,v 1.131.2.10 2006/01/17 09:39:57 dmitry Exp $ */
/* $Id: zend_language_scanner.l,v 1.131.2.11 2006/04/13 13:48:28 dmitry Exp $ */
#define yyleng SCNG(yy_leng)
#define yytext SCNG(yy_text)
......@@ -4675,7 +4675,7 @@ YY_RULE_SETUP
{
if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
zendlval->value.str.len = yyleng-2;
zendlval->type = IS_STRING;
yyless(yyleng-2);
BEGIN(ST_IN_SCRIPTING);
......
......@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_language_scanner.l,v 1.131.2.10 2006/01/17 09:39:57 dmitry Exp $ */
/* $Id: zend_language_scanner.l,v 1.131.2.11 2006/04/13 13:48:28 dmitry Exp $ */
#define yyleng SCNG(yy_leng)
#define yytext SCNG(yy_text)
......@@ -1461,7 +1461,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
yymore();
}
<ST_ONE_LINE_COMMENT>[^\n\r?%>]+{ANY_CHAR} {
<ST_ONE_LINE_COMMENT>[^\n\r?%>]*{ANY_CHAR} {
switch (yytext[yyleng-1]) {
case '?': case '%': case '>':
yyless(yyleng-1);
......@@ -1491,7 +1491,7 @@ NEWLINE ("\r"|"\n"|"\r\n")
<ST_ONE_LINE_COMMENT>"?>"|"%>" {
if (CG(asp_tags) || yytext[yyleng-2] != '%') { /* asp comment? */
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
zendlval->value.str.len = yyleng-2;
zendlval->type = IS_STRING;
yyless(yyleng-2);
BEGIN(ST_IN_SCRIPTING);
......
......@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_opcode.c,v 1.110.2.5 2006/03/14 11:24:45 dmitry Exp $ */
/* $Id: zend_opcode.c,v 1.110.2.6 2006/04/10 12:26:53 dmitry Exp $ */
#include <stdio.h>
......@@ -367,8 +367,10 @@ int pass_two(zend_op_array *op_array TSRMLS_DC)
zend_llist_apply_with_argument(&zend_extensions, (llist_apply_with_arg_func_t) zend_extension_op_array_handler, op_array TSRMLS_CC);
}
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
op_array->size = op_array->last;
if (!CG(interactive) && op_array->size != op_array->last) {
op_array->opcodes = (zend_op *) erealloc(op_array->opcodes, sizeof(zend_op)*op_array->last);
op_array->size = op_array->last;
}
opline = op_array->opcodes;
end = opline + op_array->last;
......
......@@ -130,6 +130,7 @@ typedef unsigned long int uint32_t;
* but the word order is big endian.
*/
#define IEEE_BIG_ENDIAN
#undef IEEE_LITTLE_ENDIAN
#endif
#ifdef __vax__
......
......@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
/* $Id: zend_vm_def.h,v 1.59.2.27 2006/03/15 11:12:45 dmitry Exp $ */
/* $Id: zend_vm_def.h,v 1.59.2.30 2006/07/06 15:39:23 pollita Exp $ */
/* If you change this file, please regenerate the zend_vm_execute.h and
* zend_vm_opcodes.h files by running:
......@@ -1158,7 +1158,9 @@ ZEND_VM_HELPER_EX(zend_fetch_property_address_read_helper, VAR|UNUSED|CV, CONST|
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -3017,7 +3019,20 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
array_ptr->refcount++;
if (OP1_TYPE == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
}
}
......@@ -3223,7 +3238,9 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
key->value.lval = int_key;
key->type = IS_LONG;
break;
EMPTY_SWITCH_DEFAULT_CASE()
default:
ZVAL_NULL(key);
break;
}
}
......
......@@ -2059,7 +2059,7 @@ static int ZEND_UNSET_VAR_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *array_ptr, **array_ptr_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
......@@ -2100,7 +2100,20 @@ static int ZEND_FE_RESET_SPEC_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
array_ptr->refcount++;
if (IS_CONST == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
}
}
......@@ -4518,7 +4531,20 @@ static int ZEND_FE_RESET_SPEC_TMP_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
array_ptr->refcount++;
if (IS_TMP_VAR == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
}
}
......@@ -7518,7 +7544,20 @@ static int ZEND_FE_RESET_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
array_ptr->refcount++;
if (IS_VAR == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
}
}
......@@ -7724,7 +7763,9 @@ static int ZEND_FE_FETCH_SPEC_VAR_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
key->value.lval = int_key;
key->type = IS_LONG;
break;
EMPTY_SWITCH_DEFAULT_CASE()
default:
ZVAL_NULL(key);
break;
}
}
......@@ -8633,7 +8674,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CONST(int type, ZEND
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -10057,7 +10100,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_TMP(int type, ZEND_O
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -11484,7 +11529,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_VAR(int type, ZEND_O
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -13356,7 +13403,9 @@ static int zend_fetch_property_address_read_helper_SPEC_VAR_CV(int type, ZEND_OP
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -14551,7 +14600,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CONST(int type, Z
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -15628,7 +15679,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_TMP(int type, ZEN
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -16666,7 +16719,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_VAR(int type, ZEN
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -18069,7 +18124,9 @@ static int zend_fetch_property_address_read_helper_SPEC_UNUSED_CV(int type, ZEND
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -19574,7 +19631,7 @@ static int ZEND_UNSET_VAR_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *array_ptr, **array_ptr_ptr;
HashTable *fe_ht;
zend_object_iterator *iter = NULL;
......@@ -19615,7 +19672,20 @@ static int ZEND_FE_RESET_SPEC_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
} else if (Z_TYPE_P(array_ptr) == IS_OBJECT) {
ce = Z_OBJCE_P(array_ptr);
} else {
array_ptr->refcount++;
if (IS_CV == IS_VAR &&
free_op1.var == NULL &&
!array_ptr->is_ref &&
array_ptr->refcount > 1) {
/* non-separated return value from function */
zval *tmp;
ALLOC_ZVAL(tmp);
INIT_PZVAL_COPY(tmp, array_ptr);
zval_copy_ctor(tmp);
array_ptr = tmp;
} else {
array_ptr->refcount++;
}
}
}
......@@ -20590,7 +20660,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_CONST(int type, ZEND_
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -22006,7 +22078,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_TMP(int type, ZEND_OP
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);
SELECTIVE_PZVAL_LOCK(*retval, &opline->result);
AI_USE_PTR(EX_T(opline->result.u.var).var);
......@@ -23425,7 +23499,9 @@ static int zend_fetch_property_address_read_helper_SPEC_CV_VAR(int type, ZEND_OP
if (container->type != IS_OBJECT || !Z_OBJ_HT_P(container)->read_property) {
zend_error(E_NOTICE, "Trying to get property of non-object");
if (type != BP_VAR_IS) {
zend_error(E_NOTICE, "Trying to get property of non-object");
}
*retval = EG(uninitialized_zval_ptr);