Skip to content

Commit

Permalink
ormConvertTupleNew() bugfix for PHP 8+
Browse files Browse the repository at this point in the history
method_exists(), starting in PHP 8.0 no longer accepts the first argument to be anything other than a string or an object. Before, it would sometimes be passed in method_exists(null, "onBeforeLoad"), which would be valid. Of course, it would return false. However, now, we must perform an external check to see if the first argument is null, and then never execute method_exists()
  • Loading branch information
craigify authored Aug 22, 2022
1 parent c1c32db commit e33da50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ORM/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -2364,7 +2364,7 @@ private function ormConvertTupleNew($type, $resultset, $newObj=null)
$className = strtolower(get_class($this));
$shortClassName = $this->getShortClassName($className);

if (method_exists($newObj, "onBeforeLoad")) { if ($newObj->onBeforeLoad($type) === false) return; }
if (!empty($newObj) && method_exists($newObj, "onBeforeLoad")) { if ($newObj->onBeforeLoad($type) === false) return; }

// Create the new object and populate the object variables with data. We only do this once.
if ($newObj == null)
Expand Down

0 comments on commit e33da50

Please sign in to comment.