com php-src: Add zend_read_static_property_ex API: Zend/zend_API.c Zend/zend_API.h ext/reflection/p hp_reflection.c
| From: | Nikita Popov | Date: | Fri, 29 Jun 2018 20:49:15 +0000 |
| Subject: | com php-src: Add zend_read_static_property_ex API: Zend/zend_API.c Zend/zend_API.h ext/reflection/p hp_reflection.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102331@lists.php.net to get a copy of this message | ||
Commit: 813b6fc95050b32409014877e7dc9849c16717ee
Author: Nikita Popov <nikita.ppv@gmail.com> Fri, 29 Jun 2018 22:49:15 +0200
Parents: 10b484e624e628e5f2255fab6252fc338ff114ad
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=813b6fc95050b32409014877e7dc9849c16717ee
Log:
Add zend_read_static_property_ex API
For symmetry with zend_read_property_ex.
Changed paths:
M Zend/zend_API.c
M Zend/zend_API.h
M ext/reflection/php_reflection..c
Diff:
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index b643c5f..98312b3 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -4175,21 +4175,28 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object,
const c
}
/* }}} */
-ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t
name_length, zend_bool silent) /* {{{ */
+ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool
silent) /* {{{ */
{
zval *property;
zend_class_entry *old_scope = EG(fake_scope);
- zend_string *key = zend_string_init(name, name_length, 0);
EG(fake_scope) = scope;
- property = zend_std_get_static_property(scope, key, silent);
+ property = zend_std_get_static_property(scope, name, silent);
EG(fake_scope) = old_scope;
- zend_string_efree(key);
return property;
}
/* }}} */
+ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t
name_length, zend_bool silent) /* {{{ */
+{
+ zend_string *key = zend_string_init(name, name_length, 0);
+ zval *property = zend_std_get_static_property(scope, key, silent);
+ zend_string_efree(key);
+ return property;
+}
+/* }}} */
+
ZEND_API void zend_save_error_handling(zend_error_handling *current) /* {{{ */
{
current->handling = EG(error_handling);
diff --git a/Zend/zend_API.h b/Zend/zend_API.h
index b9fdb76..64a6bde 100644
--- a/Zend/zend_API.h
+++ b/Zend/zend_API.h
@@ -356,6 +356,7 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const
ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zval *object, zend_string *name,
zend_bool silent, zval *rv);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, size_t
name_length, zend_bool silent, zval *rv);
+ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool
silent);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t
name_length, zend_bool silent);
ZEND_API char *zend_get_type_by_const(int type);
diff --git a/ext/reflection/php_reflection.c b/ext/reflection/php_reflection.c
index 6300e4a..e7bfb27 100644
--- a/ext/reflection/php_reflection.c
+++ b/ext/reflection/php_reflection.c
@@ -5496,11 +5496,7 @@ ZEND_METHOD(reflection_property, getValue)
}
if (ref->prop.flags & ZEND_ACC_STATIC) {
- zend_class_entry *old_scope = EG(fake_scope);
- EG(fake_scope) = ref->ce;
- member_p = zend_std_get_static_property(ref->ce, ref->unmangled_name, 0);
- EG(fake_scope) = old_scope;
-
+ member_p = zend_read_static_property_ex(ref->ce, ref->unmangled_name, 0);
if (member_p) {
ZVAL_DEREF(member_p);
ZVAL_COPY(return_value, member_p);