Merge branch 'PHP-7.4'

This commit is contained in:
Nikita Popov 2019-02-14 12:51:39 +01:00
commit 924142fef0
11 changed files with 167 additions and 39 deletions

View File

@ -31,6 +31,8 @@ Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 7
Warning: Creating default object from empty value in %sbug52041.php on line 7
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 8
@ -39,6 +41,8 @@ Notice: Undefined property: stdClass::$a in %sbug52041.php on line 8
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 9
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 9
Warning: Creating default object from empty value in %sbug52041.php on line 9
@ -53,6 +57,8 @@ Notice: Undefined property: stdClass::$a in %sbug52041.php on line 10
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 11
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
Warning: Creating default object from empty value in %sbug52041.php on line 11

View File

@ -7,7 +7,8 @@ $array['']->prop =& $array[0];
$array[0] = 42;
var_dump($array);
?>
--EXPECT--
--EXPECTF--
Warning: Creating default object from empty value in %sbug71539_5.php on line 3
array(2) {
[0]=>
&int(42)

80
Zend/tests/bug75921.phpt Normal file
View File

@ -0,0 +1,80 @@
--TEST--
Bug #75921: Inconsistent error when creating stdObject from empty variable
--FILE--
<?php
$null->a = 42;
var_dump($null);
unset($null);
$null->a['hello'] = 42;
var_dump($null);
unset($null);
$null->a->b = 42;
var_dump($null);
unset($null);
$null->a['hello']->b = 42;
var_dump($null);
unset($null);
$null->a->b['hello'] = 42;
var_dump($null);
unset($null);
?>
--EXPECTF--
Warning: Creating default object from empty value in %sbug75921.php on line 3
object(stdClass)#1 (1) {
["a"]=>
int(42)
}
Warning: Creating default object from empty value in %sbug75921.php on line 7
object(stdClass)#1 (1) {
["a"]=>
array(1) {
["hello"]=>
int(42)
}
}
Warning: Creating default object from empty value in %sbug75921.php on line 11
Warning: Creating default object from empty value in %sbug75921.php on line 11
object(stdClass)#1 (1) {
["a"]=>
object(stdClass)#2 (1) {
["b"]=>
int(42)
}
}
Warning: Creating default object from empty value in %sbug75921.php on line 15
Warning: Creating default object from empty value in %sbug75921.php on line 15
object(stdClass)#1 (1) {
["a"]=>
array(1) {
["hello"]=>
object(stdClass)#2 (1) {
["b"]=>
int(42)
}
}
}
Warning: Creating default object from empty value in %sbug75921.php on line 19
Warning: Creating default object from empty value in %sbug75921.php on line 19
object(stdClass)#1 (1) {
["a"]=>
object(stdClass)#2 (1) {
["b"]=>
array(1) {
["hello"]=>
int(42)
}
}
}

View File

@ -14,6 +14,7 @@ var_dump($$test);
?>
--EXPECTF--
Warning: Creating default object from empty value in %sobjects_020.php on line 7
object(stdClass)#%d (2) {
["a"]=>
*RECURSION*

View File

@ -134,6 +134,10 @@ Cannot auto-initialize an stdClass inside a reference held by property Test::$pr
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
object(Test)#3 (3) {
["prop"]=>

View File

@ -709,6 +709,10 @@ static zend_never_inline ZEND_COLD zval* ZEND_FASTCALL make_real_object(zval *ob
|| opline->opcode == ZEND_POST_INC_OBJ
|| opline->opcode == ZEND_POST_DEC_OBJ) {
zend_error(E_WARNING, "Attempt to increment/decrement property '%s' of non-object", ZSTR_VAL(property_name));
} else if (opline->opcode == ZEND_FETCH_OBJ_W
|| opline->opcode == ZEND_FETCH_OBJ_RW
|| opline->opcode == ZEND_ASSIGN_OBJ_REF) {
zend_error(E_WARNING, "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
} else {
zend_error(E_WARNING, "Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
}
@ -748,38 +752,6 @@ static zend_never_inline ZEND_COLD zval* ZEND_FASTCALL make_real_object(zval *ob
return object;
}
static zend_never_inline ZEND_COLD zval* ZEND_FASTCALL make_real_object_rw(zval *object, zval *property OPLINE_DC)
{
zval *ref = NULL;
if (Z_ISREF_P(object)) {
ref = object;
object = Z_REFVAL_P(object);
}
if (UNEXPECTED(Z_TYPE_P(object) > IS_FALSE &&
(Z_TYPE_P(object) != IS_STRING || Z_STRLEN_P(object) != 0))) {
if (opline->op1_type != IS_VAR || EXPECTED(!Z_ISERROR_P(object))) {
zend_string *tmp_property_name;
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
zend_error(E_WARNING, "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
zend_tmp_string_release(tmp_property_name);
}
return NULL;
}
if (ref) {
zend_property_info *error_prop = i_zend_check_ref_stdClass_assignable(Z_REF_P(ref));
if (error_prop) {
zend_throw_auto_init_in_ref_error(error_prop, "stdClass");
return NULL;
}
}
zval_ptr_dtor_nogc(object);
object_init(object);
return object;
}
static ZEND_COLD void zend_verify_type_error_common(
const zend_function *zf, const zend_arg_info *arg_info,
const zend_class_entry *ce, zval *value,
@ -2729,7 +2701,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
return;
}
container = make_real_object_rw(container, prop_ptr OPLINE_CC);
container = make_real_object(container, prop_ptr OPLINE_CC);
if (UNEXPECTED(!container)) {
ZVAL_ERROR(result);
return;

View File

@ -576,7 +576,7 @@ static zend_always_inline double _zend_get_nan(void) /* {{{ */
# define ZEND_INTRIN_SSSE3_FUNC_DECL(func)
#endif
#if __SSE4_2__
#ifdef __SSE4_2__
/* Instructions compiled directly. */
# define ZEND_INTRIN_SSE4_2_NATIVE 1
#elif (defined(HAVE_FUNC_ATTRIBUTE_TARGET) && defined(PHP_HAVE_SSE4_2)) || defined(ZEND_WIN32)

View File

@ -14,17 +14,19 @@ $xml_str = <<<EOD
</c_fpobel>
EOD;
$xml = simplexml_load_string ($xml_str) ;
$xml = simplexml_load_string($xml_str);
$val = 1;
var_dump($val);
$zml->pos["act_idx"] = $val;
var_dump($val) ;
var_dump($val);
?>
===DONE===
--EXPECT--
--EXPECTF--
int(1)
Warning: Creating default object from empty value in %sbug36611.php on line 17
int(1)
===DONE===

View File

@ -70,9 +70,15 @@ Warning: Creating default object from empty value in %s on line %d
good
$i->p->q=f():
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
good
$i->p[0]=f():
Warning: Creating default object from empty value in %s on line %d
good
$i->p[0]=f(): good
$i->p[0]->p=f():
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
good
C::$p=f(): good

View File

@ -157,6 +157,8 @@ array(1) {
$a->b->c
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
@ -164,12 +166,16 @@ array(1) {
}
$a->b[0]
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0][0]
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
@ -177,6 +183,8 @@ array(1) {
$a->b[0]->c
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>

View File

@ -63,6 +63,18 @@ var_dump($u1, $u2, $u3, $u4, $u5);
?>
--EXPECTF--
---- Pass uninitialised array & object by ref: function call ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -97,6 +109,18 @@ object(stdClass)#%d (1) {
}
---- Pass uninitialised arrays & objects by ref: static method call ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -132,6 +156,18 @@ object(stdClass)#%d (1) {
---- Pass uninitialised arrays & objects by ref: constructor ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -166,6 +202,18 @@ object(stdClass)#%d (1) {
}
---- Pass uninitialised arrays & objects by ref: instance method call ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"