Do not consider a method with the same name as class name to be a constructor, nor do not create such alias. This is some event from old PHP4, we do not want to support. Magic methods <__construct() & __destruct()> are more than
enough.
This commit is contained in:
parent
e53cfb8ba0
commit
d0357787db
15
vm.c
15
vm.c
@ -734,16 +734,6 @@ static sxi32 VmMountUserClass(
|
||||
*/
|
||||
return SXRET_OK;
|
||||
}
|
||||
/* Create constructor alias if not yet done */
|
||||
if(SyHashGet(&pClass->hMethod, "__construct", sizeof("__construct") - 1) == 0) {
|
||||
/* User constructor with the same base class name */
|
||||
pEntry = SyHashGet(&pClass->hMethod, SyStringData(&pClass->sName), SyStringLength(&pClass->sName));
|
||||
if(pEntry) {
|
||||
pMeth = (ph7_class_method *)pEntry->pUserData;
|
||||
/* Create the alias */
|
||||
SyHashInsert(&pClass->hMethod, "__construct", sizeof("__construct") - 1, pMeth);
|
||||
}
|
||||
}
|
||||
/* Install the methods now */
|
||||
SyHashResetLoopCursor(&pClass->hMethod);
|
||||
while((pEntry = SyHashGetNextEntry(&pClass->hMethod)) != 0) {
|
||||
@ -4970,11 +4960,6 @@ static sxi32 VmByteCodeExec(
|
||||
}
|
||||
/* Check if a constructor is available */
|
||||
pCons = PH7_ClassExtractMethod(pClass, "__construct", sizeof("__construct") - 1);
|
||||
if(pCons == 0) {
|
||||
SyString *pName = &pClass->sName;
|
||||
/* Check for a constructor with the same base class name */
|
||||
pCons = PH7_ClassExtractMethod(pClass, pName->zString, pName->nByte);
|
||||
}
|
||||
if(pCons) {
|
||||
/* Call the class constructor */
|
||||
SySetReset(&aArg);
|
||||
|
Loading…
Reference in New Issue
Block a user