com php-src: Fixed bug #70656 (require() statement broken after opcache_reset() or a few hours of use): NEWS ext/opcache/ZendAccelerator.c
| From: | Xinchen Hui | Date: | Tue, 27 Oct 2015 00:09:42 +0000 |
| Subject: | com php-src: Fixed bug #70656 (require() statement broken after opcache_reset() or a few hours of use): NEWS ext/opcache/ZendAccelerator.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-89577@lists.php.net to get a copy of this message | ||
Commit: 3ef96c2cc6f3a1dddd8479e6c733f44e8dbcb5e9
Author: Xinchen Hui <laruence@gmail.com> Mon, 26 Oct 2015 17:09:42 -0700
Parents: faf835be2bd4db8e57e2529a8022b208cd9201b2
Branches: PHP-7.0 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3ef96c2cc6f3a1dddd8479e6c733f44e8dbcb5e9
Log:
Fixed bug #70656 (require() statement broken after opcache_reset() or a few hours of use)
Bugs:
https://bugs.php.net/70656
Changed paths:
M NEWS
M ext/opcache/ZendAccelerator.c
Diff:
diff --git a/NEWS b/NEWS
index f4e6c8d...d3f0137 100644
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,13 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2015, PHP 7.0.1
+- Opcache:
+ . Fixed bug #70656 (require() statement broken after opcache_reset() or a
+ few hours of use). (Laruence)
+
- Standard:
. Fixed bug #70808 (array_merge_recursive corrupts memory of unset items).
- (laruence)
+ (Laruence)
- XSL:
. Fixed bug #70678 (PHP7 returns true when false is expected). (Felipe)
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index eaadac6..a7fb07b 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -249,24 +249,28 @@ static void accel_interned_strings_restore_state(void)
uint nIndex;
Bucket *p;
- ZCSG(interned_strings_top) = ZCSG(interned_strings_saved_top);
- while (idx > 0) {
- idx--;
- p = ZCSG(interned_strings).arData + idx;
- if ((char*)p->key < ZCSG(interned_strings_top)) break;
- ZCSG(interned_strings).nNumUsed--;
- ZCSG(interned_strings).nNumOfElements--;
-
- nIndex = p->h | ZCSG(interned_strings).nTableMask;
- if (HT_HASH(&ZCSG(interned_strings), nIndex) == HT_IDX_TO_HASH(idx)) {
- HT_HASH(&ZCSG(interned_strings), nIndex) = Z_NEXT(p->val);
- } else {
- uint32_t prev = HT_HASH(&ZCSG(interned_strings), nIndex);
- while (Z_NEXT(HT_HASH_TO_BUCKET(&ZCSG(interned_strings), prev)->val) != idx) {
- prev = Z_NEXT(HT_HASH_TO_BUCKET(&ZCSG(interned_strings), prev)->val);
- }
- Z_NEXT(HT_HASH_TO_BUCKET(&ZCSG(interned_strings), prev)->val) = Z_NEXT(p->val);
- }
+ if (EXPECTED(ZCSG(interned_strings_top) > ZCSG(interned_strings_saved_top))) {
+ memset(ZCSG(interned_strings_saved_top),
+ 0, ZCSG(interned_strings_top) - ZCSG(interned_strings_saved_top));
+ ZCSG(interned_strings_top) = ZCSG(interned_strings_saved_top);
+ while (idx > 0) {
+ idx--;
+ p = ZCSG(interned_strings).arData + idx;
+ if ((char*)p->key < ZCSG(interned_strings_top)) break;
+ ZCSG(interned_strings).nNumUsed--;
+ ZCSG(interned_strings)..nNumOfElements--;
+
+ nIndex = p->h | ZCSG(interned_strings)..nTableMask;
+ if (HT_HASH(&ZCSG(interned_strings), nIndex) == HT_IDX_TO_HASH(idx)) {
+ HT_HASH(&ZCSG(interned_strings), nIndex) = Z_NEXT(p->val);
+ } else {
+ uint32_t prev = HT_HASH(&ZCSG(interned_strings), nIndex);
+ while (Z_NEXT(HT_HASH_TO_BUCKET(&ZCSG(interned_strings), prev)->val) != idx) {
+ prev = Z_NEXT(HT_HASH_TO_BUCKET(&ZCSG(interned_strings), prev)->val);
+ }
+ Z_NEXT(HT_HASH_TO_BUCKET(&ZCSG(interned_strings), prev)->val) = Z_NEXT(p->val);
+ }
+ }
}
}