Skip to content

Commit 5c5b7bd

Browse files
committed
mapscript/php: Fix segfault in ms_newprojectionobj in PHP7.3
1 parent 95ddad7 commit 5c5b7bd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: mapscript/php/php_mapscript_util.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isre
146146
#endif /* PHP_VERSION_ID < 70000 */
147147

148148
#if PHP_VERSION_ID >= 70300
149-
#define MAPSCRIPT_ADDREF(zv) zend_gc_addref(&(Z_COUNTED(zv))->gc)
150-
#define MAPSCRIPT_ADDREF_P(p) zend_gc_addref(&(Z_COUNTED_P(p))->gc)
149+
#define MAPSCRIPT_ADDREF(zv) if(!Z_ISUNDEF(zv)) GC_ADDREF(Z_COUNTED(zv))
150+
#define MAPSCRIPT_ADDREF_P(p) if(!Z_ISUNDEF(*p)) GC_ADDREF(Z_COUNTED_P(p))
151151
#else
152152
#if PHP_VERSION_ID >= 70000
153153
#define MAPSCRIPT_ADDREF(zv) if(!(Z_ISUNDEF(zv))) GC_REFCOUNT(Z_COUNTED(zv))++;
@@ -163,7 +163,7 @@ static zend_always_inline zend_bool zval_set_isref_to_p(zval* pz, zend_bool isre
163163
if (!(Z_ISUNDEF(zv))) \
164164
{ \
165165
zend_refcounted *_gc = Z_COUNTED(zv); \
166-
zend_gc_delref(&_gc->gc); \
166+
GC_DELREF(_gc); \
167167
if(GC_REFCOUNT(_gc) == 0) \
168168
rc_dtor_func(_gc); \
169169
ZVAL_UNDEF(&zv); \

0 commit comments

Comments
 (0)