From fb18236e1c6724b37d8f4cc740ea8f0b7e6ffb92 Mon Sep 17 00:00:00 2001 From: Yoshio HANAWA Date: Wed, 12 Sep 2012 13:09:07 +0900 Subject: [PATCH] Fixed for PHP 5.2 and ZTS environment --- php_timecop.h | 10 ++++++++++ tests/006.phpt | 7 +++++-- tests/007.phpt | 7 +++++-- timecop.c | 10 +++++----- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/php_timecop.h b/php_timecop.h index 6a6e8a6..5a0e19f 100644 --- a/php_timecop.h +++ b/php_timecop.h @@ -39,6 +39,16 @@ extern zend_module_entry timecop_module_entry; #include #include "Zend/zend_interfaces.h" +#ifndef Z_ADDREF_P +/* PHP 5.2, old GC */ +#define Z_ADDREF_P(pz) (++(pz)->refcount) +#define Z_DELREF_P(pz) (--(pz)->refcount) +#define Z_REFCOUNT_P(pz) ((pz)->refcount) +#define Z_SET_REFCOUNT_P(pz, rc) ((pz)->refcount = rc) +#define Z_REFCOUNT_PP(ppz) Z_REFCOUNT_P(*(ppz)) +#define Z_DELREF_PP(ppz) Z_DELREF_P(*(ppz)) +#endif + PHP_MINIT_FUNCTION(timecop); PHP_MSHUTDOWN_FUNCTION(timecop); PHP_RINIT_FUNCTION(timecop); diff --git a/tests/006.phpt b/tests/006.phpt index f4f2263..850189b 100644 --- a/tests/006.phpt +++ b/tests/006.phpt @@ -3,7 +3,7 @@ Check for timecop.sync_request_time=1 and $_SERVER['REQUEST_TIME'] --SKIPIF--