Skip to content

Commit 28af182

Browse files
committed
Add Bug001.phpt
1 parent 73e8e2d commit 28af182

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

sg.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ static zval *sg_strtok_get(char *key, size_t key_len TSRMLS_DC) /* {{{ */
270270
}
271271

272272
#if PHP_VERSION_ID >= 70000
273+
if (pzval && Z_TYPE_P(pzval) == IS_INDIRECT) {
274+
pzval = Z_INDIRECT_P(pzval);
275+
}
273276
return pzval;
274277
#else
275278
return *pzval;

tests/bug001.phpt

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--TEST--
2+
Check for Z_TYPE_INFO = IS_INDIRECT
3+
--SKIPIF--
4+
<?php if (!extension_loaded("sg")) print "skip"; ?>
5+
--INI--
6+
sg.enable = 1
7+
sg.global_level = 1
8+
--FILE--
9+
<?php
10+
11+
/* lijinguo */
12+
13+
$a = '$a';
14+
15+
sg::set('$a', "a");
16+
17+
echo $GLOBALS[$$a], PHP_EOL;
18+
echo sg::get($$a), PHP_EOL;
19+
20+
?>
21+
--EXPECT--
22+
$a
23+
$a
24+

0 commit comments

Comments
 (0)