From 02471b4ccbbe1e81abe18d0758f958ba902e30f1 Mon Sep 17 00:00:00 2001 From: belliash Date: Wed, 29 May 2019 13:25:17 +0200 Subject: [PATCH] Do not install private methods from parent to subclass. All methods defined in superclass can be access by $this and $parent construct. There is no need to copy private methods, as they cannot be access in $this context. --- engine/oop.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/engine/oop.c b/engine/oop.c index 4f1c381..2480dfe 100644 --- a/engine/oop.c +++ b/engine/oop.c @@ -282,9 +282,11 @@ PH7_PRIVATE sxi32 PH7_ClassInherit(ph7_vm *pVm, ph7_class *pSub, ph7_class *pBas } } /* Install the method */ - rc = SyHashInsert(&pSub->hMethod, (const void *)pName->zString, pName->nByte, pMeth); - if(rc != SXRET_OK) { - return rc; + if(pMeth->iProtection != PH7_CLASS_PROT_PRIVATE) { + rc = SyHashInsert(&pSub->hMethod, (const void *)pName->zString, pName->nByte, pMeth); + if(rc != SXRET_OK) { + return rc; + } } } /* Mark first inherited class as direct subclass */