Skip to content

Commit 813b6fc

Browse files
committed
Add zend_read_static_property_ex API
For symmetry with zend_read_property_ex.
1 parent 10b484e commit 813b6fc

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

Zend/zend_API.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4175,21 +4175,28 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const c
41754175
}
41764176
/* }}} */
41774177

4178-
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent) /* {{{ */
4178+
ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool silent) /* {{{ */
41794179
{
41804180
zval *property;
41814181
zend_class_entry *old_scope = EG(fake_scope);
4182-
zend_string *key = zend_string_init(name, name_length, 0);
41834182

41844183
EG(fake_scope) = scope;
4185-
property = zend_std_get_static_property(scope, key, silent);
4184+
property = zend_std_get_static_property(scope, name, silent);
41864185
EG(fake_scope) = old_scope;
4187-
zend_string_efree(key);
41884186

41894187
return property;
41904188
}
41914189
/* }}} */
41924190

4191+
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent) /* {{{ */
4192+
{
4193+
zend_string *key = zend_string_init(name, name_length, 0);
4194+
zval *property = zend_std_get_static_property(scope, key, silent);
4195+
zend_string_efree(key);
4196+
return property;
4197+
}
4198+
/* }}} */
4199+
41934200
ZEND_API void zend_save_error_handling(zend_error_handling *current) /* {{{ */
41944201
{
41954202
current->handling = EG(error_handling);

Zend/zend_API.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, const
356356
ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zval *object, zend_string *name, zend_bool silent, zval *rv);
357357
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, const char *name, size_t name_length, zend_bool silent, zval *rv);
358358

359+
ZEND_API zval *zend_read_static_property_ex(zend_class_entry *scope, zend_string *name, zend_bool silent);
359360
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, const char *name, size_t name_length, zend_bool silent);
360361

361362
ZEND_API char *zend_get_type_by_const(int type);

ext/reflection/php_reflection.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5496,11 +5496,7 @@ ZEND_METHOD(reflection_property, getValue)
54965496
}
54975497

54985498
if (ref->prop.flags & ZEND_ACC_STATIC) {
5499-
zend_class_entry *old_scope = EG(fake_scope);
5500-
EG(fake_scope) = ref->ce;
5501-
member_p = zend_std_get_static_property(ref->ce, ref->unmangled_name, 0);
5502-
EG(fake_scope) = old_scope;
5503-
5499+
member_p = zend_read_static_property_ex(ref->ce, ref->unmangled_name, 0);
55045500
if (member_p) {
55055501
ZVAL_DEREF(member_p);
55065502
ZVAL_COPY(return_value, member_p);

0 commit comments

Comments
 (0)