Keyword

Error in system plugin v2.10.3

  • Bill Tomczak
  • Bill Tomczak's Avatar Topic Author
  • Offline
  • New Member
More
1 week 6 days ago #176639 by Bill Tomczak
Error in system plugin v2.10.3 was created by Bill Tomczak
In this block of code:
            if ($caching) {
                preg_match("#<script type=\"application/x\-k2\-headers\">(.*?)</script>#is", $response, $getK2CacheHeaders);
                $getK2CacheHeaders = json_decode(trim($getK2CacheHeaders[1]));
                if (is_object($getK2CacheHeaders)) {
                    JResponse::allowCache(true);
                    foreach ($getK2CacheHeaders as $type => $value) {
                        JResponse::setHeader($type, $value, true);
                    }
                }
            }

There are some cases where the preg_match evaluates to false causing the json_decode() to throw an error.

Would be nice to have that fixed to something like:
            if ($caching) {
                if (preg_match("#<script type=\"application/x\-k2\-headers\">(.*?)</script>#is", $response, $getK2CacheHeaders)) {
                    $getK2CacheHeaders = json_decode(trim($getK2CacheHeaders[1]));
                    if (is_object($getK2CacheHeaders)) {
                        JResponse::allowCache(true);
                        foreach ($getK2CacheHeaders as $type => $value) {
                            JResponse::setHeader($type, $value, true);
                        }
                    }
                }
            }

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 week 6 days ago #176640 by Fotis
Replied by Fotis on topic Error in system plugin v2.10.3
It's already been improved in K2 v2.10.4 (dev) - see github.com/getk2/k2/blob/master/plugins/system/k2.php#L690 - as I also stumbled into some notices/warnings as well.

You can get K2 v2.10.4 (dev) from: getk2.org/downloads/?f=K2_Development_Release.zip

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.

  • Bill Tomczak
  • Bill Tomczak's Avatar Topic Author
  • Offline
  • New Member
More
1 week 6 days ago #176641 by Bill Tomczak
Replied by Bill Tomczak on topic Error in system plugin v2.10.3
Excellent! Many thanks!

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Offline
  • Administrator
  • JoomlaWorks Support Team
More
1 week 2 days ago #176650 by Fotis
Replied by Fotis on topic Error in system plugin v2.10.3
You're welcome.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum