Edit report at https://bugs.php.net/bug.php?id=70656&edit=1
ID: 70656
Updated by: laruence@php.net
Reported by: p at wspnr dot com
Summary: require() statement broken after opcache_reset() or
a few hours of use
-Status: Assigned
+Status: Closed
Type: Bug
Package: opcache
Operating System: Debian (x86_64 and i686)
PHP Version: 7.0Git-2015-10-07 (Git)
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3ef96c2cc6f3a1dddd8479e6c733f44e8dbcb5e9
Log: Fixed bug #70656 (require() statement broken after opcache_reset() or a few hours of use)
Previous Comments:
------------------------------------------------------------------------
[2015-11-01 04:42:37] tony dot levi at blackboard dot com
Confirming that patch solves it for me too.
------------------------------------------------------------------------
[2015-11-01 03:53:35] p at wspnr dot com
Applied patch and recompiled. The bug seems to be resolved.
------------------------------------------------------------------------
[2015-11-01 03:30:36] laruence@php.net
actually, it's intentional only copy Z_STRLEN, please verify this fix:
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index eaadac6..18862b3 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -249,24 +249,27 @@ 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);
+ }
+ }
}
}
------------------------------------------------------------------------
[2015-10-31 17:49:34] kalle@php.net
Hey Xinchen, can you confirm this fix is proper or clarify the behavior? Thanks
------------------------------------------------------------------------
[2015-10-31 08:09:31] tony dot levi at blackboard dot com
I can confirm that workaround and proposed fix solve the issue for me.
It looks like the right solution - based on pattern elsewhere - but I'm not an expert either.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=70656
--
Edit this bug report at https://bugs.php.net/bug.php?id=70656&edit=1