NextGen compatibility error with Litespeed Server
-
NextGen Gallery version 3.59.4 threw an error on a page (The Event Calendar) but appears to actually be an incompatibility after turning on my hosting Litespeed Server and cache. The error is:
“Notice: Undefined property: stdClass::$content in /home/xxxxxxx/public_html/yyyyyyyy.org/wp-content/plugins/nextgen-gallery/src/Util/Router.php on line 595”
The NextGen code comments actually state that the code has a known bug, but it is too time consuming to fix! Here is your code:
public function fix_page_parameter() {
global $post;if ( $post && is_object( $post ) && is_string( $post->content ) && ( strpos( $post->content, '<!--nextpage-->' ) === false ) && ( strpos( $_SERVER['REQUEST_URI'], '/page/' ) !== false ) && preg_match( '#/page/(\\d+)#', $_SERVER['REQUEST_URI'], $match ) ) *{ $_REQUEST['page'] = $match[1]; } }
Here is my fix:
public function fix_page_parameter() {
global $post;if ( $post && is_object( $post ) && property_exists($post, 'content') && is_string( $post->content ) && ( strpos( $post->content, '<!--nextpage-->' ) === false ) && ( strpos( $_SERVER['REQUEST_URI'], '/page/' ) !== false ) && preg_match( '#/page/(\\d+)#', $_SERVER['REQUEST_URI'], $match ) ) { $_REQUEST['page'] = $match[1]; }
}
Please examine for release. Thanks.
- You must be logged in to reply to this topic.