From d0357787db50574604999a601a69c71e190f025c Mon Sep 17 00:00:00 2001 From: belliash Date: Fri, 13 Jul 2018 17:58:50 +0200 Subject: [PATCH] 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. --- vm.c | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/vm.c b/vm.c index 50a29e6..447bf14 100644 --- a/vm.c +++ b/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);