Skip to content

Commit

Permalink
ENH Various fixes for PHP 8.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Apr 11, 2022
1 parent fab7143 commit 63c0bfd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Versioned.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use SilverStripe\ORM\DataList;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataQuery;
use SilverStripe\ORM\DataQuery_SubGroup;
use SilverStripe\ORM\DB;
use SilverStripe\ORM\FieldType\DBDatetime;
use SilverStripe\ORM\Queries\SQLSelect;
Expand Down Expand Up @@ -655,6 +656,9 @@ protected function prepareMaxVersionSubSelect(SQLSelect $baseQuery, DataQuery $d
// We can ONLY promote a filter on the primary key of the base table. Any other conditions will make the
// version returned incorrect, as we are filtering out version that may be the latest (and correct) version
foreach ($baseQuery->getWhere() as $condition) {
if (is_object($condition)) {
continue;
}
$conditionClause = key($condition);
// Pull out the table and field for this condition. We'll skip anything we can't parse
if (preg_match('/^"([^"]+)"\."([^"]+)"/', $conditionClause, $matches) !== 1) {
Expand Down

0 comments on commit 63c0bfd

Please sign in to comment.