View Issue Details

IDProjectCategoryView StatusLast Update
0006767OXID eShop (all versions)4.07. Source code, Testpublic2018-01-12 14:46
Reporterhenrik.steffen Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version6.0.0 
Summary0006767: Lazy loading problem with __isset() in BaseModel.php
DescriptionWe've noticed that the behavior in lazy loading somehow changed comparing PHP 5.6 and PHP 7.

It can happen that isset() gives NULL if the specified variable has never been accessed before.

Obviously OXID developers also noticed the problem, because in function getCustomVAT() from OXID version 4.10.6 to 6.0.0 the code was changed from:

 public function getCustomVAT()
    {
        if (isset($this->oxarticles__oxvat->value)) {
            return $this->oxarticles__oxvat->value;
        }
    }


into:

public function getCustomVAT()
   {
       if ($this->__isset('oxarticles__oxvat') || $this->__get('oxarticles__oxvat')) {
           return $this->oxarticles__oxvat->value;
       }
   }

This solves the problem for the oxvat ONLY -

However, we would suggest to apply this patch not here but directly in the BaseModel.php by adding a __get to the __isset function... changing it from:

return isset($this->$variableName);

return isset($this->$variableName) === true || $this->__get($variableName);

This would make sure, all occurencies of __isset() in the code would work as expected without any lazy loading issues.
TagsNo tags attached.
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

There are no notes attached to this issue.