EE4 compatibility updates:

  • Publisher is EE4 and EE5 compatible, but it does not currently support the Fluid field (it's in the works).
  • Reel is EE4 and EE5 compatible, but it does not currently support the Fluid field.

Ticket: PHP error LowSearch 3.0.1 / Publisher 1.0.15

Status Resolved
Add-on / Version Publisher 1.0.15
Severity Critical
EE Version 2.7.2

Rob Post

Dec 03, 2013

Just updated a working site to publisher 1.0.14 -> 1.0.15 / LowSearch 2.34 -> 3.0.1 / Publisher low search master 1.01 -> 1.0.2

And now getting errors on all pages using the LowSearch form:

Fatal error: Call to undefined method Low_search_base::encode() in /Applications/MAMP/htdocs/laarhoven-nl/e2services/expressionengine/third_party/publisher/libraries/Publisher/Publisher_parser.php on line 339

#1

BoldMinded (Deprecated)

This is fixed in the next release, here is a diff of the fix.

diff --git a/third_party/publisher/libraries/Publisher/Publisher_parser.php b/third_party/publisher/libraries/Publisher/Publisher_parser.php
index fb703a5569cd7dfd85094563159c1dfd31ff5bb8..0d1aa66df547d92315a8f8a68339925e69cda4f9 100644
--- a/third_party/publisher/libraries/Publisher/Publisher_parser.php
+++ b/third_party/publisher/libraries/Publisher/Publisher_parser.php
@@ -321,22 +321,30 @@ class Publisher_parser {
                             $form_tag_full = str_replace($content_matches[0][$k], $str, $form_tag_full);
                         }
                         // Low Search specific, don't like doing this. Abstract it out later.
+                        // Ideally there would be a hook in the form method in EE.
                         elseif ($name == 'params' && array_key_exists('low_search', ee()->addons->get_installed('modules')))
                         {
                             $params = json_decode(base64_decode($value));
 
                             if (is_object($params) && isset($params->result_page))
                             {   
-                                require_once PATH_THIRD.'low_search/base.low_search.php';
-                                $low = new Low_search_base();
-
                                 $result_page = $this->_swap_url($params->result_page);
 
                                 $args['action'] = $result_page;
 
                                 // Update the params field and cast it back to an array.
                                 $params->result_page = $result_page;
-                                $value = $low->encode((array)$params);
+
+                                if (function_exists('low_search_encode'))
+                                {
+                                    $value = low_search_encode((array)$params);
+                                }
+                                else
+                                {
+                                    require_once PATH_THIRD.'low_search/base.low_search.php';
+                                    $low = new Low_search_base();
+                                    $value = $low->encode((array)$params);
+                                }
 
                                 // Replace the contents with our newly translated value.
                                 $str = '<input type="hidden" name="'. $name .'" value="'. $value .'" />';
#2

Rob Post

Thanks. That fixed the issue!

Login to reply