Skip to content

Commit 9855df1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into merge-php-code
2 parents 6eb1b04 + 0dfa27e commit 9855df1

File tree

6 files changed

+1667
-6
lines changed

6 files changed

+1667
-6
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ php:
1313
- 5.6
1414
- 7.0
1515
- 7.1
16+
- 7.2
1617
- master
1718

1819
before_script:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,10 @@ var_dump((new DateTime())->format("c")); // string(25) "2017-01-01T00:00:05+00:0
142142

143143
## CHANGELOG
144144

145+
### version 1.2.10(beta), 2017/11/23
146+
147+
- Fix "double free" bug on PHP 7.2.0 ([#32](https://github.com/hnw/php-timecop/issues/32))
148+
145149
### version 1.2.8(beta), 2017/7/7
146150

147151
- Publish on PECL

circle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ general:
77

88
dependencies:
99
pre:
10-
- case $CIRCLE_NODE_INDEX in 0) sudo apt-get update; sudo apt-get install php5-dev; phpenv global system ;; 1) phpenv global 5.5.36 ;; 2) phpenv global 5.6.22 ;; 3) phpenv global 7.0.11 ;; esac
10+
- case $CIRCLE_NODE_INDEX in 0) sudo apt-get update; sudo apt-get install php5-dev; phpenv global system ;; 1) phpenv global 5.6.22 ;; 2) phpenv global 7.0.11 ;; 3) phpenv global 7.1.9 ;; esac
1111
- phpenv versions
1212
- phpize && ./configure && make
1313

package.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
<email>y@hnw.jp</email>
1515
<active>yes</active>
1616
</lead>
17-
<date>2017-07-07</date>
17+
<date>2017-11-23</date>
1818
<version>
19-
<release>1.2.8</release>
20-
<api>1.2.8</api>
19+
<release>1.2.10</release>
20+
<api>1.2.10</api>
2121
</version>
2222
<stability>
2323
<release>beta</release>
2424
<api>beta</api>
2525
</stability>
2626
<license uri="https://github.com/hnw/php-timecop/blob/master/LICENSE">MIT License</license>
27-
<notes>Publish on PECL
27+
<notes>Fix "double free" bug on PHP 7.2.0
2828
</notes>
2929
<contents>
3030
<dir name="/">

timecop.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SOFTWARE.
2525
#ifndef PHP_TIMECOP_H
2626
#define PHP_TIMECOP_H
2727

28-
#define PHP_TIMECOP_VERSION "1.2.8"
28+
#define PHP_TIMECOP_VERSION "1.2.10"
2929

3030
#ifdef HAVE_CONFIG_H
3131
#include "config.h"
@@ -153,6 +153,24 @@ ZEND_END_MODULE_GLOBALS(timecop)
153153
#define TIMECOP_OCE(cname, mname) \
154154
{cname, mname, OVRD_CLASS_PREFIX cname, SAVE_FUNC_PREFIX mname}
155155

156+
/*
157+
* Trick for guarding the multi-referenced internal function from function destructor on PHP 7.2.0+
158+
* See: https://github.com/hnw/php-timecop/issues/29#issuecomment-332171527
159+
*/
160+
#define GUARD_FUNCTION_ARG_INFO_BEGIN(zend_func) { \
161+
zend_arg_info *orig_arg_info; \
162+
zend_function *zf = zend_func; \
163+
if (zf->type == ZEND_INTERNAL_FUNCTION) { \
164+
orig_arg_info = zf->common.arg_info; \
165+
zf->common.arg_info = NULL; \
166+
}
167+
168+
#define GUARD_FUNCTION_ARG_INFO_END() \
169+
if (zf->type == ZEND_INTERNAL_FUNCTION) { \
170+
zf->common.arg_info = orig_arg_info; \
171+
} \
172+
}
173+
156174
struct timecop_override_func_entry {
157175
char *orig_func;
158176
char *ovrd_func;

0 commit comments

Comments
 (0)