getgrav / getgrav/grav-plugin-admin
Search fails with "trying to access array offset on value of type bool"
- Dominant language
- PHP
- Stars
- 377
- Forks
- 225
- Avg merge
- 11h 51m
- Merged PRs (30d)
- 4
Description
Grav v1.7.42.3 PHP 8.1.2-1ubuntu2.13
Whenever I request a search I get this. The error line is
…/user/plugins/external_links/classes/ExternalLinks.php:122
The top of the stack trace looks like this:
```
54 Whoops\Exception\ErrorException
…/user/plugins/external_links/classes/ExternalLinks.php:294
53 Grav\Common\Debugger deprecatedErrorHandler
…/user/plugins/external_links/classes/ExternalLinks.php:294
52 Grav\Plugin\ExternalLinks getImageSize
…/user/plugins/external_links/classes/ExternalLinks.php:122
51 Grav\Plugin\ExternalLinks Grav\Plugin\{closure}
[internal]:0
50 preg_replace_callback
…/user/plugins/external_links/classes/ExternalLinks.php:45
```
Everything else seems to be working just fine. I know it was working a couple of years ago, but I don't use search much so not sure when this went wrong. I have it running locally and reproduced the problem there, but I first noticed it on the public site. Both run under nginx
Contributor guide
Research direction
Reproduce a search request with Grav v1.7.42.3 and PHP 8.1, then inspect user/plugins/external_links/classes/ExternalLinks.php at lines 45, 122, and 294, following the provided stack trace through getImageSize. Trace why the callback receives a boolean and confirm that searches complete without the reported array-offset error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend, search
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100