]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0' into PHP-7.1
authorDmitry Stogov <dmitry@zend.com>
Thu, 26 Oct 2017 10:11:59 +0000 (13:11 +0300)
committerDmitry Stogov <dmitry@zend.com>
Thu, 26 Oct 2017 10:11:59 +0000 (13:11 +0300)
* PHP-7.0:
  Fixed indirect modification of magic method arguments.

1  2 
Zend/zend_object_handlers.c

index ed972c718c1c2e8cb54ff6f24685e8ec765757a5,8028b2ee5b46d4b8c00a92f98cf6d85a461557fc..e8530340fb8906a29262882db31c9ede8822b925
@@@ -574,10 -507,10 +574,10 @@@ ZEND_API uint32_t *zend_get_property_gu
  zval *zend_std_read_property(zval *object, zval *member, int type, void **cache_slot, zval *rv) /* {{{ */
  {
        zend_object *zobj;
-       zval tmp_member;
+       zval tmp_member, tmp_object;
        zval *retval;
        uint32_t property_offset;
 -      zend_long *guard = NULL;
 +      uint32_t *guard = NULL;
  
        zobj = Z_OBJ_P(object);
  
                        zval_ptr_dtor(&tmp_object);
                        goto exit;
                } else {
 -                      if (Z_STRVAL_P(member)[0] == '\0') {
 -                              if (Z_STRLEN_P(member) == 0) {
 -                                      zend_throw_error(NULL, "Cannot access empty property");
 -                                      retval = &EG(uninitialized_zval);
 -                                      goto exit;
 -                              } else {
 -                                      zend_throw_error(NULL, "Cannot access property started with '\\0'");
 -                                      retval = &EG(uninitialized_zval);
 -                                      goto exit;
 -                              }
+                       zval_ptr_dtor(&tmp_object);
 +                      if (Z_STRVAL_P(member)[0] == '\0' && Z_STRLEN_P(member) != 0) {
 +                              zend_throw_error(NULL, "Cannot access property started with '\\0'");
 +                              retval = &EG(uninitialized_zval);
 +                              goto exit;
                        }
                }
        }