|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-03-14 06:47 UTC] peacech at gmail dot com
Description:
------------
At least the method getName() in ReflectionMethod and ReflectionParameters always returns false. I haven't check other reflection classes.
This only happens when apc is loaded (svn r324146)
Copying newp->arKey like shown in below diff fixes the problem but I'm not sure if it's the correct way.
--- apc_compile.c (revision 324205)
+++ apc_compile.c (working copy)
@@ -889,6 +889,7 @@
CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
} else if (IS_INTERNED(curr->arKey)) {
CHECK((newp = (Bucket*) apc_pmemcpy(curr, sizeof(Bucket), pool TSRMLS_CC)));
+ CHECK((newp->arKey = (char*) apc_pmemcpy(curr->arKey, curr->nKeyLength, pool TSRMLS_CC)));
#ifndef ZTS
} else if (pool->type != APC_UNPOOL) {
char *arKey;
Test script:
---------------
<?php
function a() { }
var_dump((new ReflectionFunction($a0))->getName());
Expected result:
----------------
"a"
Actual result:
--------------
false
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 12:00:02 2025 UTC |
I have isolated where the problem is: in apc_string.c (function apc_copy_internal_strings) if (ce->name) { //ZEND_STR_INTERN_DUP(ce->name, ce->name_length) ce->name = apc_new_interned_string(ce->name, ce->name_length TSRMLS_CC); } if (info->name) { //ZEND_STR_INTERN_DUP(info->name, info->name_length) info->name = apc_new_interned_string(info->name, info->name_length TSRMLS_CC); } If I use ZEND_STR_INTERN_DUP then the reflection method works but otherwise it fails. It's starting to fail from revision 324142 while it works in 324141.This also works if (ce->name) { //ZEND_STR_INTERN_DUP(ce->name, ce->name_length) ce->name = apc_new_interned_string(ce->name, ce->name_length+1 TSRMLS_CC); //ce->name = apc_new_interned_string(ce->name, ce->name_length TSRMLS_CC); } q = ce->properties_info.pListHead; while (q) { zend_property_info *info = (zend_property_info*)(q->pData); if (q->nKeyLength) { q->arKey = apc_new_interned_string(q->arKey, q->nKeyLength TSRMLS_CC); } if (info->name) { //ZEND_STR_INTERN_DUP(info->name, info->name_length) info->name = apc_new_interned_string(info->name, info->name_length+1 TSRMLS_CC); //info->name = apc_new_interned_string(info->name, info->name_length TSRMLS_CC); } q = q->pListNext; }