Skip to content

Commit b201b8a

Browse files
committed
Update for new PHP 7.3 REFCOUNT macros
1 parent e0ccf87 commit b201b8a

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

Diff for: .travis.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ dist: trusty
33

44
language: php
55
php:
6+
- master
67
- 7.2
78
- 7.1
89
- 7.0
910

1011
matrix:
1112
fast_finish: true
13+
allow_failures:
14+
- php: master
1215

1316
env:
1417
- LIBMEMCACHED_VERSION=1.0.18 # Debian Jessie / Ubuntu Xenial

Diff for: php_memcached.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ static PHP_METHOD(Memcached, __construct)
12981298
le.type = php_memc_list_entry();
12991299
le.ptr = intern->memc;
13001300

1301-
GC_REFCOUNT(&le) = 1;
1301+
GC_SET_REFCOUNT(&le, 1);
13021302

13031303
/* plist_key is not a persistent allocated key, thus we use str_update here */
13041304
if (zend_hash_str_update_mem(&EG(persistent_list), ZSTR_VAL(plist_key), ZSTR_LEN(plist_key), &le, sizeof(le)) == NULL) {
@@ -3831,7 +3831,7 @@ PHP_METHOD(MemcachedServer, on)
38313831

38323832
Z_TRY_ADDREF(fci.function_name);
38333833
if (fci.object) {
3834-
GC_REFCOUNT(fci.object)++;
3834+
GC_ADDREF(fci.object);
38353835
}
38363836
}
38373837
RETURN_BOOL(rc);

Diff for: php_memcached_private.h

+7
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,13 @@ typedef unsigned long int uint32_t;
7272
# endif
7373
#endif
7474

75+
/* Backwards compatibility for GC API change in PHP 7.3 */
76+
#if PHP_VERSION_ID < 70300
77+
# define GC_ADDREF(p) ++GC_REFCOUNT(p)
78+
# define GC_DELREF(p) --GC_REFCOUNT(p)
79+
# define GC_SET_REFCOUNT(p, rc) GC_REFCOUNT(p) = rc
80+
#endif
81+
7582
/****************************************
7683
Structures and definitions
7784
****************************************/

Diff for: php_memcached_session.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ PS_OPEN_FUNC(memcached)
376376
le.type = s_memc_sess_list_entry();
377377
le.ptr = memc;
378378

379-
GC_REFCOUNT(&le) = 1;
379+
GC_SET_REFCOUNT(&le, 1);
380380

381381
/* plist_key is not a persistent allocated key, thus we use str_update here */
382382
if (zend_hash_str_update_mem(&EG(persistent_list), plist_key, plist_key_len, &le, sizeof(le)) == NULL) {

0 commit comments

Comments
 (0)