From 602548e77e4bfa3653b1f4c5ca273f43857c8e17 Mon Sep 17 00:00:00 2001 From: Ian Turgeon Date: Thu, 21 Nov 2019 15:40:22 -0500 Subject: [PATCH] update wordpress to 5.3 and php 7.2 * wordpress updated to >= 5.3.0 * php minimum requirement moved up to 7.2 (as per wordpress's needs) * fix to deal with an ugly bug with php 7.1+ and pecl-memcached for sessions * php 7.2 highlighted a few syntax errors that were fixed here --- composer.json | 4 +- composer.lock | 42 +++++++++---------- internal/app.php | 19 +++++++++ internal/classes/obo/log/LogManager.class.php | 2 +- internal/classes/obo/util/Cache.class.php | 2 +- .../rocketD/auth/AuthManager.class.php | 2 +- 6 files changed, 45 insertions(+), 26 deletions(-) diff --git a/composer.json b/composer.json index a7079c75f..ee7d6948b 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,10 @@ } ], "require": { - "php": ">=5.4", + "php": ">=7.2", "onelogin/php-saml": "2.10.2", "monolog/monolog": "1.18.2", - "johnpbloch/wordpress": ">=5.1.1", + "johnpbloch/wordpress": ">=5.3.0", "obojobo/obo-stats": "0.0.3", "obojobo/rocketD": "0.0.3", "obojobo-themes/obojobo": "0.0.3", diff --git a/composer.lock b/composer.lock index f22aa965b..97f7f6926 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "134d518ae8eddd259ba3a7ad31e1ec91", + "content-hash": "9f1ac609001464125fc0d6d9c98ed32a", "packages": [ { "name": "composer/installers", @@ -163,22 +163,22 @@ }, { "name": "johnpbloch/wordpress", - "version": "5.1.1", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress.git", - "reference": "b5673ea8f30a518eaf311c90f1d074c44b54e15e" + "reference": "2b710cf99daf1c219948cd6ee4719ccfbd12e109" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/b5673ea8f30a518eaf311c90f1d074c44b54e15e", - "reference": "b5673ea8f30a518eaf311c90f1d074c44b54e15e", + "url": "https://api.github.com/repos/johnpbloch/wordpress/zipball/2b710cf99daf1c219948cd6ee4719ccfbd12e109", + "reference": "2b710cf99daf1c219948cd6ee4719ccfbd12e109", "shasum": "" }, "require": { - "johnpbloch/wordpress-core": "5.1.1", + "johnpbloch/wordpress-core": "5.3.0", "johnpbloch/wordpress-core-installer": "^1.0", - "php": ">=5.3.2" + "php": ">=5.6.20" }, "type": "package", "notification-url": "https://packagist.org/downloads/", @@ -191,34 +191,34 @@ "homepage": "http://wordpress.org/about/" } ], - "description": "WordPress is web software you can use to create a beautiful website or blog.", + "description": "WordPress is open source software you can use to create a beautiful website, blog, or app.", "homepage": "http://wordpress.org/", "keywords": [ "blog", "cms", "wordpress" ], - "time": "2019-03-13T00:27:35+00:00" + "time": "2019-11-12T20:45:58+00:00" }, { "name": "johnpbloch/wordpress-core", - "version": "5.1.1", + "version": "5.3.0", "source": { "type": "git", "url": "https://github.com/johnpbloch/wordpress-core.git", - "reference": "dba22982e7cb433b68f1b12a0bd4e5851f967010" + "reference": "17ddddaf049e82655c6d3831ca787350807b0566" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/dba22982e7cb433b68f1b12a0bd4e5851f967010", - "reference": "dba22982e7cb433b68f1b12a0bd4e5851f967010", + "url": "https://api.github.com/repos/johnpbloch/wordpress-core/zipball/17ddddaf049e82655c6d3831ca787350807b0566", + "reference": "17ddddaf049e82655c6d3831ca787350807b0566", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=5.6.20" }, "provide": { - "wordpress/core-implementation": "5.1.1" + "wordpress/core-implementation": "5.3.0" }, "type": "wordpress-core", "notification-url": "https://packagist.org/downloads/", @@ -231,14 +231,14 @@ "homepage": "http://wordpress.org/about/" } ], - "description": "WordPress is web software you can use to create a beautiful website or blog.", + "description": "WordPress is open source software you can use to create a beautiful website, blog, or app.", "homepage": "http://wordpress.org/", "keywords": [ "blog", "cms", "wordpress" ], - "time": "2019-03-13T00:27:30+00:00" + "time": "2019-11-12T20:45:53+00:00" }, { "name": "johnpbloch/wordpress-core-installer", @@ -649,15 +649,15 @@ }, { "name": "wpackagist-plugin/w3-total-cache", - "version": "0.10.2", + "version": "0.11.0", "source": { "type": "svn", "url": "https://plugins.svn.wordpress.org/w3-total-cache/", - "reference": "tags/0.10.2" + "reference": "tags/0.11.0" }, "dist": { "type": "zip", - "url": "https://downloads.wordpress.org/plugin/w3-total-cache.0.10.2.zip" + "url": "https://downloads.wordpress.org/plugin/w3-total-cache.0.11.0.zip" }, "require": { "composer/installers": "~1.0" @@ -673,7 +673,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.4" + "php": ">=7.2" }, "platform-dev": [] } diff --git a/internal/app.php b/internal/app.php index da44df2e0..5a7079b0a 100644 --- a/internal/app.php +++ b/internal/app.php @@ -74,3 +74,22 @@ function classAutoLoader($className) } @include($file); } + +// Fix a bug with php7.1 + and php72-pecl-memcache which breaks the session handling w/ memcache +class PeclMemcacheBugFixForSessionsHandler extends SessionHandler +{ + public function read($id) + { + $data = parent::read($id); + // the bug is a result of pecl-memcache not returning an empty string + // and that being incompatable with php 7.1's session handler + return empty($data) ? '' : $data; + } +} + +if(\AppCfg::CACHE_MEMCACHE === true) +{ + $sessionHandler = new PeclMemcacheBugFixForSessionsHandler(); + session_set_save_handler($sessionHandler); +} +// END php72-pecl-memcache bug fix diff --git a/internal/classes/obo/log/LogManager.class.php b/internal/classes/obo/log/LogManager.class.php index 7b4c78480..e82060746 100644 --- a/internal/classes/obo/log/LogManager.class.php +++ b/internal/classes/obo/log/LogManager.class.php @@ -256,7 +256,7 @@ protected function getInteractionLogs($query, $totalsOnly=false) { $toSection = (int) ($r->{\cfg_obo_Track::IN} == 0 ? 1 : $r->{\cfg_obo_Track::IN}); $pageIndex = '?'; - if(isset($lo->pages) && count($lo->pages > 0)) + if(isset($lo->pages) && count($lo->pages) > 0) { switch($toSection) { diff --git a/internal/classes/obo/util/Cache.class.php b/internal/classes/obo/util/Cache.class.php index 94469e1d9..457b9e097 100644 --- a/internal/classes/obo/util/Cache.class.php +++ b/internal/classes/obo/util/Cache.class.php @@ -130,7 +130,7 @@ public function clearLock($loid) { if($this->memEnabled) { - $this->delete($this->ns.'\obo\Lock:'.$lock->lockID); + $this->delete($this->ns.'\obo\Lock:'.$loid); } } diff --git a/internal/classes/rocketD/auth/AuthManager.class.php b/internal/classes/rocketD/auth/AuthManager.class.php index c03a09817..5ac71d9d9 100644 --- a/internal/classes/rocketD/auth/AuthManager.class.php +++ b/internal/classes/rocketD/auth/AuthManager.class.php @@ -435,7 +435,7 @@ public function authenticate($requestVars, $authID=0 ) $authModList = $this->getAllAuthModules(); // loop through authmods - if(count($authModList > 0)) + if(count($authModList) > 0) { foreach($authModList AS $authMod) {