Magento CE 2.3.5-p1 Admin error when editing product - Session ID is not used as URL parameter anymore

magento.stackexchange https://magento.stackexchange.com/questions/313346

  •  14-04-2021
  •  | 
  •  

Question

Having recently upgraded to community edition ver. 2.3.5-p1, and I've run into an error when editing a product in the admin.

While logged in, if I goto a product page to edit, e.g.

hostname/admin/catalog/product/edit/id/1/key/0f76b993ab32a0a1700d6f5c1e0ecbe55ac5d88004e0971e2ac4f26cc0e837e5/

I see the product name, then an error and nothing else as shown in the photo.

The error text is: User Deprecated Functionality: Session ID is not used as URL parameter anymore. in /domains/hostname/http/vendor/magento/framework/Url.php on line 763

The only error I've been able to find in the logs is the same.

[2020-05-20 22:40:06] main.CRITICAL: User Deprecated Functionality: Session ID is not used as URL parameter anymore. in /domains/hostname/http/vendor/magento/framework/Url.php on line 763 [] []

Text

I hope somebody can offer a suggestion? Note that Session IDs are not visible in the URLs on the consumer frontend. However I do have the site open in the same browser as the admin.

Thanks

Don

Était-ce utile?

La solution

This is because an old extension tries to use session parameters which was deprecated. We tried fixing this using DonB from Florida's answer. But that shows only a part of the problem. Best is to use below commands to find a list of potential old/deprecated extensions:

grep -r 'addSessionParam()' vendor/
grep -r 'addSessionParam()' app/code/

and:

grep -r 'setUseSessionInUrl' vendor/
grep -r 'setUseSessionInUrl' app/code/

After finding the possible culprit. Simply remove 'setUseSessionInUrl' and/or 'addSessionParam' from the code. Then clear cache and recompile and the error should go away.

Autres conseils

In my case this was an extension error. Tracked down by modifying: vendor/magento/framework/Url.php

diff --git a/vendor/magento/framework/Url.php b/vendor/magento/framework/Url.php
index 4bcc2d9a8..f026f7690 100644
--- a/vendor/magento/framework/Url.php
+++ b/vendor/magento/framework/Url.php
@@ -760,6 +760,12 @@ class Url extends \Magento\Framework\DataObject implements \Magento\Framework\Ur
      */
     public function addSessionParam()
     {
+        $logger = \Magento\Framework\App\ObjectManager::getInstance()->get(\Psr\Log\LoggerInterface::class);
+        $logger->info('In URL for Session ID');
+        $debugBackTrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
+        foreach ($debugBackTrace as $item) {
+            $logger->info(@$item['class'] . @$item['type'] . @$item['function']);
+        }
         trigger_error('Session ID is not used as URL parameter anymore.', E_USER_DEPRECATED);

This fix was as follows.

git diff vendor/cloudinary/cloudinary/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php
diff --git a/vendor/cloudinary/cloudinary/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/vendor/cloudinary/cloudinary/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php
index b4aee9d..4ffd67a 100644
--- a/vendor/cloudinary/cloudinary/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php
+++ b/vendor/cloudinary/cloudinary/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php
@@ -68,7 +68,7 @@ class Content extends \Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Galle
             [
             'htmlId' => $this->getHtmlId(),
             'cldMLid' => 'product_gallery_' . $this->getHtmlId(),
-            'imageUploaderUrl' => $this->_urlBuilder->addSessionParam()->getUrl('cloudinary/ajax/retrieveImage'),
+            'imageUploaderUrl' => $this->_urlBuilder->getUrl('cloudinary/ajax/retrieveImage'),

To look for other issues, I ran: grep -r 'addSessionParam()' vendor

Licencié sous: CC-BY-SA avec attribution
Non affilié à magento.stackexchange
scroll top