-
-
Notifications
You must be signed in to change notification settings - Fork 531
Open
Labels
bugThe issue in the code or project, which should be addressed.The issue in the code or project, which should be addressed.
Milestone
Description
Bug report
Summary
I have a resource with a snippet [[apiPhotoResize]] in it. The resource is uncached, the snippet cached. Its used to resize images on a webpage, to load faster as using pThumb directly inside the document. This resource getting requested 180 times/second on a pageload.
I get some PHP errors:
PHP Fatal error: Uncaught TypeError: readdir(): supplied resource is not a valid Directory resource in core/xpdo/cache/xpdocachemanager.class.php:504
Stack trace:
#0 core/xpdo/cache/xpdocachemanager.class.php(504): readdir(Resource id #182)
#1 core/xpdo/cache/xpdocachemanager.class.php(1021): xPDOCacheManager->deleteTree('/www/htdocs/w01...', Array)
#2 core/xpdo/cache/xpdocachemanager.class.php(721): xPDOFileCache->delete('modSnippet', Array)
#3 core/xpdo/xpdo.class.php(2360): xPDOCacheManager->delete('modSnippet', Array)
#4 core/xpdo/om/xpdoobject.class.php(1498): xPDO->toCache(Object(xPDOQuery_mysql), Object(modSnippet_mysql), 0, Array)
#5 core/model/modx/modaccessibleobject.class.php(178): xPDOObject->save(NULL)
#6 core/model/modx/modelement.class.php(180): modAccessibleObject->save(NULL)
#7 core/model/modx/modsnippet.class.php(39): modElement->save(NULL)
#8 core/model/modx/modelement.class.php(449): modSnippet->save()
#9 core/model/modx/modelement.class.php(305): modElement->getContent(Array)
#10 core/model/modx/modscript.class.php(65): modElement->process(NULL, NULL)
#11 core/model/modx/modparser.class.php(537): modScript->process(NULL)
#12 core/components/pdotools/model/pdotools/pdoparser.class.php(273): modParser->processTag(Array, false)
#13 core/model/modx/modparser.class.php(251): pdoParser->processTag(Array, false)
#14 core/components/pdotools/model/pdotools/pdoparser.class.php(64): modParser->processElementTags('', '[[apiPhotoResiz...', false, false, '[[', ']]', Array, 0)
#15 core/model/modx/modresource.class.php(520): pdoParser->processElementTags('', '[[apiPhotoResiz...', false, false, '[[', ']]', Array, 0)
#16 core/model/modx/modresponse.class.php(166): modResource->process()
#17 core/model/modx/modrequest.class.php(138): modResponse->outputContent(Array)
#18 core/model/modx/modrequest.class.php(122): modRequest->prepareResponse()
#19 core/model/modx/modx.class.php(1461): modRequest->handleRequest()
#20 site/index.php(54): modX->handleRequest()
#21 {main}
thrown in core/xpdo/cache/xpdocachemanager.class.php on line 504
I changed this:
| while (false !== ($file= @ readdir($handle))) { |
Into this:
if (!is_resource($handle)) {
continue;
}
while (false !== ($file= @readdir($handle))) {
Environment
MODX 2.8.5
Apache
PHP Version 8.1.16
Metadata
Metadata
Assignees
Labels
bugThe issue in the code or project, which should be addressed.The issue in the code or project, which should be addressed.