Skip to content

Commit 2bf2ced

Browse files
committed
Initialize attributes for internal functions
Fixes a crash in Symfony SecurityBundle tests.
1 parent 48e9181 commit 2bf2ced

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
--TEST--
2+
Reflect attributes on different kinds of internal symbols
3+
--FILE--
4+
<?php
5+
6+
$rf = new ReflectionFunction('unserialize');
7+
var_dump($rf->getAttributes());
8+
9+
$rc = new ReflectionClass('DateTime');
10+
var_dump($rc->getAttributes());
11+
12+
$rm = $rc->getMethod('__construct');
13+
var_dump($rm->getAttributes());
14+
15+
$rcc = $rc->getReflectionConstant('ATOM');
16+
var_dump($rcc->getAttributes());
17+
18+
$rp = new ReflectionProperty('Exception', 'message');
19+
var_dump($rp->getAttributes());
20+
21+
?>
22+
--EXPECT--
23+
array(0) {
24+
}
25+
array(0) {
26+
}
27+
array(0) {
28+
}
29+
array(0) {
30+
}
31+
array(0) {
32+
}

Zend/zend_API.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
23252325
internal_function->function_name = zend_string_init_interned(ptr->fname, fname_len, 1);
23262326
internal_function->scope = scope;
23272327
internal_function->prototype = NULL;
2328+
internal_function->attributes = NULL;
23282329
if (ptr->flags) {
23292330
if (!(ptr->flags & ZEND_ACC_PPP_MASK)) {
23302331
if (ptr->flags != ZEND_ACC_DEPRECATED && scope) {

0 commit comments

Comments
 (0)