]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.4'
authorChristoph M. Becker <cmbecker69@gmx.de>
Wed, 24 Jun 2020 09:19:17 +0000 (11:19 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Wed, 24 Jun 2020 09:19:17 +0000 (11:19 +0200)
* PHP-7.4:
  Fix #69804: ::getStaticPropertyValue() throws on protected props

1  2 
ext/reflection/php_reflection.c
ext/reflection/tests/006.phpt
ext/reflection/tests/ReflectionClass_getStaticPropertyValue_001.phpt
ext/reflection/tests/ReflectionClass_setStaticPropertyValue_001.phpt

index 2208b76aa9672a33961006df91d60e90c575e8a8,c3c29d880b5cf2b18c1a621dc1435e051807ef00..8f0e22dd0415ce74987c6ce228c6ef2d79602bb0
@@@ -3930,10 -3811,10 +3930,10 @@@ ZEND_METHOD(ReflectionClass, getStaticP
  
  /* {{{ proto public mixed ReflectionClass::getStaticPropertyValue(string name [, mixed default])
     Returns the value of a static property */
 -ZEND_METHOD(reflection_class, getStaticPropertyValue)
 +ZEND_METHOD(ReflectionClass, getStaticPropertyValue)
  {
        reflection_object *intern;
-       zend_class_entry *ce;
+       zend_class_entry *ce, *old_scope;
        zend_string *name;
        zval *prop, *def_value = NULL;
  
  
  /* {{{ proto public void ReflectionClass::setStaticPropertyValue(string $name, mixed $value)
     Sets the value of a static property */
 -ZEND_METHOD(reflection_class, setStaticPropertyValue)
 +ZEND_METHOD(ReflectionClass, setStaticPropertyValue)
  {
        reflection_object *intern;
-       zend_class_entry *ce;
+       zend_class_entry *ce, *old_scope;
        zend_property_info *prop_info;
        zend_string *name;
        zval *variable_ptr, *value;
index c21aa5af8b477eeac6b7d566d4cd1ce33e9f9193,0e33e0a6a17d4334d8fcb21aaa757047a20e519e..2b03f3e69432d357d08457239747b10f9ced86ae
@@@ -94,7 -112,4 +110,3 @@@ string(7) "updated
  string(7) "updated"
  string(7) "updated"
  string(7) "updated"
- EXCEPTION
- EXCEPTION
 -===DONE===
index b11d2ec0d752dc96ae66fb4a814e718e3d816d5c,c63ee330d4a8e83367ab462d7617f20a91fd87af..2b4cd27a946cf4f507f288b65fc0818bf171d7a7
@@@ -34,17 -33,17 +33,17 @@@ var_dump($rcB->getStaticPropertyValue("
  
  echo "\nRetrieving non-existent values from A with no default value:\n";
  try {
-     var_dump($rcA->getStaticPropertyValue("protectedOverridden"));
+       var_dump($rcA->getStaticPropertyValue("protectedDoesNotExist"));
 -      echo "you should not see this";
 +    echo "you should not see this";
  } catch (Exception $e) {
 -      echo $e->getMessage() . "\n";
 +    echo $e->getMessage() . "\n";
  }
  
  try {
-     var_dump($rcA->getStaticPropertyValue("privateOverridden"));
+       var_dump($rcA->getStaticPropertyValue("privateDoesNotExist"));
 -      echo "you should not see this";
 +    echo "you should not see this";
  } catch (Exception $e) {
 -      echo $e->getMessage() . "\n";
 +    echo $e->getMessage() . "\n";
  }
  
  ?>
index f51f4136b1e6c075b9567106790d89a722b5f2d5,41a6482f66d1497428673e39c34ca791a30d55c5..1414cfadb7a3a9882f5f656cf44d08c7840e3480
@@@ -35,17 -35,17 +35,17 @@@ print_r($rcB->getStaticProperties())
  
  echo "\nSet non-existent values from A with no default value:\n";
  try {
-     var_dump($rcA->setStaticPropertyValue("protectedOverridden", "new value 8"));
+       var_dump($rcA->setStaticPropertyValue("protectedDoesNotExist", "new value 8"));
 -      echo "you should not see this";
 +    echo "you should not see this";
  } catch (Exception $e) {
 -      echo $e->getMessage() . "\n";
 +    echo $e->getMessage() . "\n";
  }
  
  try {
-     var_dump($rcA->setStaticPropertyValue("privateOverridden", "new value 9"));
+       var_dump($rcA->setStaticPropertyValue("privateDoesNotExist", "new value 9"));
 -      echo "you should not see this";
 +    echo "you should not see this";
  } catch (Exception $e) {
 -      echo $e->getMessage() . "\n";
 +    echo $e->getMessage() . "\n";
  }
  
  ?>