Skip to content
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

server error PHPHtmlParser\Dom #849

Closed
JohnMica opened this issue May 25, 2016 · 14 comments
Closed

server error PHPHtmlParser\Dom #849

JohnMica opened this issue May 25, 2016 · 14 comments

Comments

@JohnMica
Copy link

JohnMica commented May 25, 2016

Latest beta of all plugins, antimatter theme,
Until yesterday it all worked fine.

Today I got this little error (not sure if its a server issue or grav issue)
captura de ecran din 2016 05 25 la 16 16 47

In the log, the last line with the error is:

[2016-05-25 18:20:37] grav.CRITICAL: Cannot use object of type PHPHtmlParser\Dom as array - Trace: #0 /home/canabism/public_html/vendor/twig/twig/lib/Twig/Environment.php(396): Twig_Environment->compileSource(Object(PHPHtmlParser\Dom), '@Page:/home/can...') #1 /home/canabism/public_html/vendor/twig/twig/lib/Twig/Environment.php(347): Twig_Environment->loadTemplate('@Page:/home/can...') #2 /home/canabism/public_html/system/src/Grav/Common/Twig/Twig.php(243): Twig_Environment->render('@Page:/home/can...', Array) #3 /home/canabism/public_html/system/src/Grav/Common/Page/Page.php(704): Grav\Common\Twig\Twig->processPage(Object(Grav\Common\Page\Page), Object(PHPHtmlParser\Dom)) #4 /home/canabism/public_html/system/src/Grav/Common/Page/Page.php(593): Grav\Common\Page\Page->processTwig() #5 /home/canabism/public_html/user/plugins/assets/assets.php(127): Grav\Common\Page\Page->content() #6 [internal function]: Grav\Plugin\AssetsPlugin->onPageInitialized(Object(RocketTheme\Toolbox\Event\Event), 'onPageInitializ...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #7 /home/canabism/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(184): call_user_func(Array, Object(RocketTheme\Toolbox\Event\Event), 'onPageInitializ...', Object(RocketTheme\Toolbox\Event\EventDispatcher)) #8 /home/canabism/public_html/vendor/symfony/event-dispatcher/EventDispatcher.php(46): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, 'onPageInitializ...', Object(RocketTheme\Toolbox\Event\Event)) #9 /home/canabism/public_html/vendor/rockettheme/toolbox/Event/src/EventDispatcher.php(23): Symfony\Component\EventDispatcher\EventDispatcher->dispatch('onPageInitializ...', Object(RocketTheme\Toolbox\Event\Event)) #10 /home/canabism/public_html/system/src/Grav/Common/Grav.php(298): RocketTheme\Toolbox\Event\EventDispatcher->dispatch('onPageInitializ...', Object(RocketTheme\Toolbox\Event\Event)) #11 /home/canabism/public_html/system/src/Grav/Common/Processors/PagesProcessor.php(12): Grav\Common\Grav->fireEvent('onPageInitializ...') #12 /home/canabism/public_html/system/src/Grav/Common/Grav.php(123): Grav\Common\Processors\PagesProcessor->process() #13 /home/canabism/public_html/system/src/Grav/Common/Grav.php(385): Grav\Common\Grav->Grav\Common\{closure}() #14 [internal function]: Grav\Common\Grav::Grav\Common\{closure}('pages', 'Pages', Object(Closure)) #15 /home/canabism/public_html/system/src/Grav/Common/Grav.php(361): call_user_func_array(Object(Closure), Array) #16 /home/canabism/public_html/system/src/Grav/Common/Grav.php(124): Grav\Common\Grav->__call('measureTime', Array) #17 /home/canabism/public_html/index.php(37): Grav\Common\Grav->process() #18 {main} [] []

@rhukster
Copy link
Member

That's a weird one. Can i get a zipped copy of your user/ folder?

@JohnMica
Copy link
Author

JohnMica commented May 25, 2016

yep just a moment - i have asked the guys at siteground to check it out as well - the folder is about 30+ MB so I'll link it with dropbox in a sec

https://www.dropbox.com/sh/7tv17xgzb8pwghh/AAB1Jq2pJARXMRJOMq7RcArEa?dl=0 link to dropbox - its all synced and ready to inspect 📦

@JohnMica
Copy link
Author

Siteground came back - it seems that php7 is causing most of the errors. When switching back to php5.6 most of the errors disappear.
Hope this helps a bit in debugging it. Localhost gives me same errors :(

@JohnMica
Copy link
Author

http://www.awesomescreenshot.com/03f5wbwy39 Only one error appears now with php 5.6

@rhukster
Copy link
Member

Grav should run fine with PHP7.0 or PHP5.6. I use both extensively. Have you tried clearing the cache?

@JohnMica
Copy link
Author

Cache is empty but now it E_ERROR .... (Same php parser details as before) .. Can you duplicate this? Could it be due to a plugin that has some issues perhaps?

@rhukster
Copy link
Member

Been busy on other stuff, but will test now.

@JohnMica
Copy link
Author

Found the culprit - image plugins (both new ones) are causing this error. I disabled them and now site works as expected....

@rhukster
Copy link
Member

I was just replying with the same thing! imsgsrcset and imgcaptions right?

@JohnMica
Copy link
Author

Yeo both of them I believe. I disabled both of them to make sure. Now I'm at work with access to my little phone only so can't test each individual. I opened an issue with the creator (Ole) and wait to see what could cause this

@OleVik
Copy link
Contributor

OleVik commented May 28, 2016

This will be from ImgSrcset, as ImgCaptions does not use a DOMParser. Working on a resolution in its repository.

@JohnMica
Copy link
Author

interesting thing @rhukster - the DOM error seems to have disappeared however, when changing twig_first : true in system.yaml the images are not rendered anymore as you can see in the photo attached. Could this still be a bug in admin / Grav or perhaps the imgsrcset plugin is changing the photos that much that Grav cant process them no more ?
captura de ecran din 2016 05 29 la 17 56 09

captura de ecran din 2016 05 29 la 19 49 14

I'm sure @OleVik is trying to figure out what is actually causing the error in the first place but since you guys know more about php / programming the I will ever do hopefully the solution will arise by investigating ?

@rhukster
Copy link
Member

It's quite possible that twig_first is causing the problems. There are so many options in Grav now that it's inevitable that some combinations cause problems. As I dont know much about the imgsrcset plugin, i'll have to leave this to Ole to solve :)

@OleVik
Copy link
Contributor

OleVik commented May 29, 2016

twig_first is not the problem, rather, it is the effects of twig_first: false. I presume that when this option is disabled other effects on the processed Markdown could take precedence - thus manipulating img-elements would be hampered in some fashion.

I have not debugged the issue in full extent - that is a rather long line to thread through many layers of Grav-operations - but I will make a note of checking whether twig_first is set for v1.1.0 of the plugin. Also, I will look into a more graceful solution to throwing the exception than the DOMParser does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants