-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grav 1.6.18 is an incomplete fix for PHP 7.4 issues #2750
Comments
Ah I guess I didn’t have a test case here I was actually using that filter type. Will require a similar check. |
Check Grav 1.7 where I've actually got rid of the array. |
@mahagr Wrong place to ask, I know, but is there a way to get |
In your
Then do a force self upgrade:
|
Please reopen this issue, the fix is still incomplete Running a version of Grav at commit 41d31cb results in a new error for me, which seems related because it's still referencing Pages.php: Whoops \ Exception \ ErrorException (E_NOTICE) Code highlighted is Line 1313 in Pages.php: grav/system/src/Grav/Common/Page/Pages.php Line 1313 in 41d31cb
Prior to any of this, PHP 7.3/Grav 1.6.17 was working fine. |
Clearly PHP 7.4 is much stricter about the case statement. Can you try replacing the entire 'for' loop with this: foreach ($pages as $key => $info) {
$child = $this->instances[$key] ?? null;
if (!$child) {
throw new \RuntimeException("Page does not exist: {$key}");
}
switch ($order_by) {
case 'title':
$list[$key] = $child->title();
break;
case 'date':
$list[$key] = $child->date();
$sort_flags = SORT_REGULAR;
break;
case 'modified':
$list[$key] = $child->modified();
$sort_flags = SORT_REGULAR;
break;
case 'publish_date':
$list[$key] = $child->publishDate();
$sort_flags = SORT_REGULAR;
break;
case 'unpublish_date':
$list[$key] = $child->unpublishDate();
$sort_flags = SORT_REGULAR;
break;
case 'slug':
$list[$key] = $child->slug();
break;
case 'basename':
$list[$key] = basename($key);
break;
case 'folder':
$list[$key] = $child->folder();
break;
case 'manual':
case 'default':
default:
if (isset($header_query[0]) && is_string($header_query[0])) {
$child_header = new Header((array)$child->header());
$header_value = $child_header->get($header_query[0]);
if (is_array($header_value)) {
$list[$key] = implode(',', $header_value);
} elseif ($header_value) {
$list[$key] = $header_value;
} else {
$list[$key] = $header_default ?: $key;
}
$sort_flags = $sort_flags ?: SORT_REGULAR;
} else {
$list[$key] = $key;
$sort_flags = $sort_flags ?: SORT_REGULAR;
}
}
} |
Sorry I was unable to test the previous comment. However, upgrading to 1.6.19 definitely fixed it on my server. All seems to work fine now. Thanks. |
No worries, i actually changed it again to bring it more inline with 1.7 branch |
Hello,
After updating my arch linux server to PHP 7.4 today, Grav 1.6.17 broke. Found a new release of Grav, 1.6.18, which contains the PHP 7.4 fix, and installed it (238ba9b).
Grav is still complaining of an error in Pages.php:
Whoops \ Exception \ ErrorException (E_NOTICE)
Trying to access array offset on value of type null
The indicated code is as follows:
The highlighted line is 1311 in Pages.php:
grav/system/src/Grav/Common/Page/Pages.php
Line 1311 in 238ba9b
As you can see, my stacktrace does indeed include the PHP 7.4 fix on 1309, so it appears that 1.6.18 is at best a partial fix.
The text was updated successfully, but these errors were encountered: