Closed romainpoirier closed 2 years ago
This is a duplication for #113 so closing to be contiuned there. I'm wondering if this is resolved in #115 by @juban and the DOMDocument requirement. As I cant cause it but I have a full PHP module setup. So that's may guess. s
FYI, below is my setup where this error happens on both tested env. I know my MySQL version is under the minimal requirement of Craft 4, but I can't get a newer. Can it be the cause of this error?
DEV (MAMP Pro) PHP version 8.1.0 OS version Darwin 21.4.0 Database driver & version MySQL 5.7.34 Image driver & version Imagick 3.5.1 (ImageMagick 6.9.6-2) Craft edition & version Craft Pro 4.1.0.2 Yii version 2.0.45 Twig version v3.3.10 Guzzle version 7.4.5
STAGING PHP version 8.1.0 OS version Linux 4.9.182-paas-110c975 Database driver & version MySQL 5.7.23 Image driver & version Imagick 3.6.0 (ImageMagick 6.9.7-4) Craft edition & version Craft Pro 4.1.0.2 Yii version 2.0.45 Twig version v3.3.10 Guzzle version 7.4.5
The line 104
of /src/services/OembedService.php
is affected:
$code = Utils::iframe($media->url);
2022-06-29 12:46:04 [web.ERROR] [Exception] Serialization of 'DOMDocument' is not allowed {"trace":["#0 /srv/data/web/vhosts/example.com/vendor/yiisoft/yii2/caching/Cache.php(249): serialize()","#1 /srv/data/web/vhosts/example.com/vendor/wrav/oembed/src/services/OembedService.php(170): yii\\caching\\Cache->set()","#2 /srv/data/web/vhosts/example.com/vendor/wrav/oembed/src/services/OembedService.php(44): wrav\\oembed\\services\\OembedService->embed()","#3 /srv/data/web/vhosts/example.com/vendor/wrav/oembed/src/variables/OembedVariable.php(39): wrav\\oembed\\services\\OembedService->render()","#4 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Extension/CoreExtension.php(1607): wrav\\oembed\\variables\\OembedVariable->render()","#5 /srv/data/web/vhosts/example.com/vendor/craftcms/cms/src/helpers/Template.php(101): twig_get_attribute()","#6 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/45/459495b1410571d9c215b8731f6f2def.php(152): craft\\helpers\\Template::attribute()","#7 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(394): __TwigTemplate_2e33b1b42ada9c471e1c7777fdcee018->doDisplay()","#8 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()","#9 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/0f/0feca5d6fb940a5d0a0c375dfe618378.php(112): Twig\\Template->display()","#10 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Extension/CoreExtension.php(1202): __TwigTemplate_5238b977fd82af205365b1771b254501->macro_blocks()","#11 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/b2/b213766f761f89a8590eba4c4b3e42e9.php(83): twig_call_macro()","#12 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(171): __TwigTemplate_687dfb80f9732ee455bc2a89dd78dbae->block_main()","#13 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/72/72f2e21eda49bf06d53235817d4d505b.php(167): Twig\\Template->displayBlock()","#14 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(171): __TwigTemplate_f73a3b316fa53836eb16ffc59ea8bad0->block_body()","#15 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/3b/3bd4f19c2bc8a430ea5d0ddb1ff0361b.php(187): Twig\\Template->displayBlock()","#16 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(394): __TwigTemplate_5e37b9d7a71c223fcb30c37c43c40003->doDisplay()","#17 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()","#18 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/72/72f2e21eda49bf06d53235817d4d505b.php(44): Twig\\Template->display()","#19 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(394): __TwigTemplate_f73a3b316fa53836eb16ffc59ea8bad0->doDisplay()","#20 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()","#21 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/b2/b213766f761f89a8590eba4c4b3e42e9.php(48): Twig\\Template->display()","#22 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(394): __TwigTemplate_687dfb80f9732ee455bc2a89dd78dbae->doDisplay()","#23 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()","#24 /srv/data/web/vhosts/example.com/storage/runtime/compiled_templates/53/532931d97f8d0548925e5e6be1f7ff5e.php(39): Twig\\Template->display()","#25 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(394): __TwigTemplate_e07fc3f0ad3377a6671828a62c78333d->doDisplay()","#26 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(367): Twig\\Template->displayWithErrorHandling()","#27 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Template.php(379): Twig\\Template->display()","#28 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/TemplateWrapper.php(40): Twig\\Template->render()","#29 /srv/data/web/vhosts/example.com/vendor/twig/twig/src/Environment.php(277): Twig\\TemplateWrapper->render()","#30 /srv/data/web/vhosts/example.com/vendor/craftcms/cms/src/web/View.php(414): Twig\\Environment->render()","#31 /srv/data/web/vhosts/example.com/vendor/craftcms/cms/src/web/View.php(467): craft\\web\\View->renderTemplate()","#32 /srv/data/web/vhosts/example.com/vendor/craftcms/cms/src/web/TemplateResponseFormatter.php(52): craft\\web\\View->renderPageTemplate()","#33 /srv/data/web/vhosts/example.com/vendor/yiisoft/yii2/web/Response.php(1095): craft\\web\\TemplateResponseFormatter->format()","#34 /srv/data/web/vhosts/example.com/vendor/craftcms/cms/src/web/Response.php(286): yii\\web\\Response->prepare()","#35 /srv/data/web/vhosts/example.com/vendor/yiisoft/yii2/web/Response.php(339): craft\\web\\Response->prepare()","#36 /srv/data/web/vhosts/example.com/vendor/yiisoft/yii2/base/Application.php(390): yii\\web\\Response->send()","#37 /srv/data/web/vhosts/example.com/htdocs/index.php(26): yii\\base\\Application->run()","#38 {main}"],"memory":13688976,"exception":"[object] (Exception(code: 0): Serialization of 'DOMDocument' is not allowed at /srv/data/web/vhosts/example.com/vendor/yiisoft/yii2/caching/Cache.php:249)\n[previous exception] [object] (Error(code: 0): Class \"wrav\\oembed\\services\\Utils\" not found at /srv/data/web/vhosts/example.com/vendor/wrav/oembed/src/services/OembedService.php:104)"}
2022-06-29 12:46:04 [web.WARNING] [application] Request context: {"userId":1,"sessionId":"6t382mhro4r20kj3bn89cik7kg","vars":{"_GET":{"p":"fr/locations/locations-privees"},"_POST":[],"_COOKIE":{"CraftSessionId":"6t382mhro4r20kj3bn89cik7kg","995b21e0a36aa4c8048448ff6b47f0e2_identity":"40768f4c1f60c280fa1067136c23e4e1fdc253e6b602d1a3dd059726fc0a46e7a:2:{i:0;s:41:\"995b21e0a36aa4c8048448ff6b47f0e2_identity\";i:1;s:159:\"[1,\"[\\\"33qSUAYxPL9fDO4Tk1mddynl_DuCcJymxWUfkCsdPHfkNNAKCi291j1aGEVKHj1WCEzQx2ofbPTUnZFKM-Mp6xNKfRMQ5n9rcjXG\\\",null,\\\"d3d4068a11f4e0f44e4527b12fc4b98f\\\"]\",3600]\";}","CRAFT_CSRF_TOKEN":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","995b21e0a36aa4c8048448ff6b47f0e2_username":"e79e5676dc4fbfb46ca629a6a5bdc53d66217741aa8a60720df281defe67d146a:2:{i:0;s:41:\"995b21e0a36aa4c8048448ff6b47f0e2_username\";i:1;s:25:\"john@doe.com\";}"},"_FILES":[],"_SERVER":{"LC_ALL":"C","LD_LIBRARY_PATH":"/opt/mysql-5.7/lib/x86_64-linux-gnu","_":"/sbin/capsh","LANG":"C","OLDPWD":"/","DB_VERSION":"5.7","CUSTOMER_DIR":"/srv/data","container_ttys":"/dev/pts/0 /dev/pts/1 /dev/pts/2 /dev/pts/3","MAX_MEM":"256","DB_USER":"hosting-db","PREFIX":"/","container":"lxc","LOCAL_DIR":"/srv/run","WWW_ENGINE":"php","PWD":"/home/hosting-user","HOME":"/home/hosting-user","SYS_USER":"hosting-admin","TMPDIR":"/srv/data/tmp","DB_ENGINE":"mysql","PAAS":"lamp0","APP_USER":"hosting-app0","PAAS_USER":"hosting-user","SHLVL":"2","WWW_VERSION":"8.1","NO_MOUNT":"yes","LOGROTATE_CONF":"/srv/data/var/admin/logrotate.conf","PHP_USER":"hosting-user","PATH":"/usr/sbin:/usr/bin:/sbin/:/bin:/opt/php-8.1/bin:/opt/php-8.1/sbin:/opt/php-8.1/usr/bin:/opt/php-8.1/usr/sbin:/opt/mysql-5.7/bin:/opt/mysql-5.7/sbin:/opt/mysql-5.7/usr/bin:/opt/mysql-5.7/usr/sbin:/opt/sqlite-3/bin","GITWEB_USER":"hosting-user","LD_PRELOAD":" /usr/local/lib/gandi/gandi-preload.so","DISTRIB":"jessie","USER":"hosting-user","SCRIPT_NAME":"/index.php","REQUEST_URI":"/fr/locations/locations-privees","QUERY_STRING":"p=fr/locations/locations-privees","REQUEST_METHOD":"GET","SERVER_PROTOCOL":"HTTP/1.1","GATEWAY_INTERFACE":"CGI/1.1","REDIRECT_QUERY_STRING":"p=fr/locations/locations-privees","REDIRECT_URL":"/fr/locations/locations-privees","REMOTE_PORT":"30686","SCRIPT_FILENAME":"/srv/data/web/vhosts/example.com/htdocs/index.php","SERVER_ADMIN":"[no address given]","CONTEXT_DOCUMENT_ROOT":"/srv/data/web/vhosts/example.com/htdocs","CONTEXT_PREFIX":"","REQUEST_SCHEME":"https","DOCUMENT_ROOT":"/srv/data/web/vhosts/example.com/htdocs","REMOTE_ADDR":"2a02:1811:3a89:5400:3ce4:b077:80c3:8f0","SERVER_PORT":"443","SERVER_ADDR":"172.22.18.10","SERVER_NAME":"example.com","SERVER_SOFTWARE":"Apache","SERVER_SIGNATURE":"","HTTP_COOKIE":"CraftSessionId=6t382mhro4r20kj3bn89cik7kg; 995b21e0a36aa4c8048448ff6b47f0e2_identity=40768f4c1f60c280fa1067136c23e4e1fdc253e6b602d1a3dd059726fc0a46e7a%3A2%3A%7Bi%3A0%3Bs%3A41%3A%22995b21e0a36aa4c8048448ff6b47f0e2_identity%22%3Bi%3A1%3Bs%3A159%3A%22%5B1%2C%22%5B%5C%2233qSUAYxPL9fDO4Tk1mddynl_DuCcJymxWUfkCsdPHfkNNAKCi291j1aGEVKHj1WCEzQx2ofbPTUnZFKM-Mp6xNKfRMQ5n9rcjXG%5C%22%2Cnull%2C%5C%22d3d4068a11f4e0f44e4527b12fc4b98f%5C%22%5D%22%2C3600%5D%22%3B%7D;","HTTP_X_FORWARDED_FOR":"2a02:1811:3a89:5400:3ce4:b077:80c3:8f0","HTTP_ACCEPT_ENCODING":"gzip","HTTP_GANDI_RP":"693051","HTTP_HOST":"example.com","HTTP_X_COUNTRY_CODE":"BE","HTTP_X_FORWARDED_PROTO":"https","HTTP_ACCEPT_LANGUAGE":"fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7,de;q=0.6,nl;q=0.5,la;q=0.4","HTTP_REFERER":"https://example.com/fr/locations","HTTP_SEC_FETCH_DEST":"document","HTTP_SEC_FETCH_USER":"?1","HTTP_SEC_FETCH_MODE":"navigate","HTTP_SEC_FETCH_SITE":"same-origin","HTTP_ACCEPT":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","HTTP_USER_AGENT":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.0.0 Safari/537.36","HTTP_UPGRADE_INSECURE_REQUESTS":"1","HTTP_SEC_CH_UA_PLATFORM":"\"macOS\"","HTTP_SEC_CH_UA_MOBILE":"?0","HTTP_SEC_CH_UA":"\".Not/A)Brand\";v=\"99\", \"Google Chrome\";v=\"103\", \"Chromium\";v=\"103\"","HTTP_SCHEME":"https","proxy-nokeepalive":"1","HTTPS":"on","REDIRECT_STATUS":"200","REDIRECT_HTTPS":"on","FCGI_ROLE":"RESPONDER","PHP_SELF":"/index.php","REQUEST_TIME_FLOAT":1656506762.281049,"REQUEST_TIME":1656506762,"ENVIRONMENT":"production","APP_ID":"CraftCMS--8e75f052-2926-42ab-ae51-00fb83a9ced5","SECURITY_KEY":"••••••••••••••••••••••••••••••••","DB_DRIVER":"mysql","DB_SERVER":"localhost","DB_PORT":"8889","DB_DATABASE":"test","DB_PASSWORD":"•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","DB_SCHEMA":"","DB_TABLE_PREFIX":"craft_","CP_TRIGGER":"admin","IS_SYSTEM_LIVE":"true","SYSTEM_NAME":"Les test","SYSTEM_NOREPLY_ADDRESS":"noreply@test.be","SYSTEM_EMAIL_ADDRESS":"john@doe.com","ROOT_URL":"https://stag.test.be","SITE_FR":"https://example.com/fr","SITE_NL":"https://example.com/nl","SITE_EN":"https://example.com/en","ASSETS_BASE_URL":"https://example.com/assets","IMGIX_HOST":"test--craft4.imgix.net","SUPPORT_EMAIL_ADDRESS":"john@doe.com","SENDER_NAME":"Test","HTML_EMAIL_TEMPLATE":"_mailing/default.twig","MANDRILL_API_KEY":"••••••••••••••••••••••","MANDRILL_SUBACCOUNT":"test","ID_SPECIAL_CATEGORY":"1960"},"_SESSION":{"c6cbdb11005a3ca9189a19b4ea85e25e__flash":[],"995b21e0a36aa4c8048448ff6b47f0e2__token":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","995b21e0a36aa4c8048448ff6b47f0e2__id":1,"__authKey":"••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••","995b21e0a36aa4c8048448ff6b47f0e2__expire":1656510362,"__duration":3600,"c6cbdb11005a3ca9189a19b4ea85e25e__auth_access":["editStructure:3"]}}}
can you include your php modules?
Also can you update to 2.1.0 and is if that ext-dom
passes the composer update
PHP modules:
utilities-module modules\utilitiesmodule\UtilitiesModule verbb-base verbb\base\Base
I'm more asking if php-xml
is installing I believe PHP 8.1 doesn't default with it. The v2.1.0 update should confirm that DOMDocument is using ext-dom
I just built up a new docker-compose setup with 8.1 now with the 2.1.0 changes to confirm I'll see what more I can find
After updating to 2.1.0
and using the same setup as previously, the same error happens. I didn't see the ext-dom
on composer update.
I don't see it under the CP System Report
tab, but the DOM extension
is green checked.
Searching the PHP Info tab in the CP does not explicit return result for ext-dom
or php-xml
.
But I can see this:
dom DOM/XML enabled DOM/XML API Version 20031129 libxml Version 2.9.4 HTML Support enabled XPath Support enabled XPointer Support enabled Schema Support enabled RelaxNG Support enabled
libxml libXML support active libXML Compiled Version 2.9.4 libXML Loaded Version 20904 libXML streams enabled
SimpleXML SimpleXML support enabled Schema support enabled
xml XML Support active XML Namespace Support active libxml2 Version 2.9.4
xmlreader XMLReader enabled
xmlwriter XMLWriter enabled
Rebuilting my docker-compose setup one of the services were using PHP 8.0 still so it was my side that was the issue. Im looking into it ATM
Try using dev-bugfix/issue-113
it converts the Class to JSON and back to StdClass. The fields will be static and locked so if your using cache on you should use the following.
{{ entry.field.media.height|default }}
{{ entry.field.media.something|default }}
This will just left you handle bits you won't from a "live" response but URL and code should always be there as a minimum I believe.
Let me know how that goes.
Check out #117 to feedback on PR too
v2.2.0 (CraftCMS v4) and v1.3.18 (CraftCMS v3) tagged with cached changes. This snapshots the object and metadata be good to look over any defaults you might need.
Thank you, after updating to 2.2.1
I can't replicate the error.
{{ craft.oembed.render(url) }}
using version2.0.0
underCraft 4.1.0.2
returns this error:Serialization of 'DOMDocument' is not allowed