summaryrefslogtreecommitdiff
path: root/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch
diff options
context:
space:
mode:
Diffstat (limited to 'www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch')
-rw-r--r--www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch625
1 files changed, 625 insertions, 0 deletions
diff --git a/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch b/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch
new file mode 100644
index 0000000..43f047c
--- /dev/null
+++ b/www-apps/gallery/files/0001-Fixing-PHP-7-issues.patch
@@ -0,0 +1,625 @@
+From b180528e518ecd35c8f47e301db8d816f3ed480d Mon Sep 17 00:00:00 2001
+From: Greg Stoll <greg@gregstoll.com>
+Date: Tue, 28 Mar 2017 15:17:53 -0500
+Subject: [PATCH 1/2] Fixing PHP 7 issues
+
+The real fixes are replacing uses of preg_replace with the 'e' mode with
+preg_replace_callback and the change to
+modules/core/clases/GalleryStorage/GalleryStorageExtras to add {}. The
+rest is just declaring functions static to avoid noisy warning messages,
+but there are plenty more that could be added.
+---
+ .gitignore | 3 ++
+ lib/adodb/adodb-time.inc.php | 1 -
+ lib/adodb/adodb.inc.php | 2 +-
+ lib/bbcode/stringparser.class.php | 2 +-
+ lib/smarty/Smarty_Compiler.class.php | 12 ++++-
+ lib/support/GallerySetupUtilities.class | 26 +++++-----
+ modules/core/classes/GalleryCoreApi.class | 16 +++---
+ modules/core/classes/GalleryDataCache.class | 16 +++---
+ .../GalleryStorage/GalleryStorageExtras.class | 2 +-
+ modules/core/classes/GalleryUtilities.class | 59 ++++++++++++----------
+ 10 files changed, 77 insertions(+), 62 deletions(-)
+ create mode 100644 .gitignore
+
+diff --git a/.gitignore b/.gitignore
+new file mode 100644
+index 0000000..3503017
+--- /dev/null
++++ b/.gitignore
+@@ -0,0 +1,3 @@
++config.php
++login.txt
++*.swp
+diff --git a/lib/adodb/adodb-time.inc.php b/lib/adodb/adodb-time.inc.php
+index 575578c..eb6c415 100644
+--- a/lib/adodb/adodb-time.inc.php
++++ b/lib/adodb/adodb-time.inc.php
+@@ -1006,7 +1006,6 @@ function adodb_tz_offset($gmt,$isphp5)
+ return sprintf('%s%02d%02d',($gmt<=0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60);
+ else
+ return sprintf('%s%02d%02d',($gmt<0)?'+':'-',floor($zhrs),($zhrs-$hrs)*60);
+- break;
+ }
+
+
+diff --git a/lib/adodb/adodb.inc.php b/lib/adodb/adodb.inc.php
+index 092e46e..2ff4486 100644
+--- a/lib/adodb/adodb.inc.php
++++ b/lib/adodb/adodb.inc.php
+@@ -373,7 +373,7 @@
+ * All error messages go through this bottleneck function.
+ * You can define your own handler by defining the function name in ADODB_OUTP.
+ */
+- function outp($msg,$newline=true)
++ static function outp($msg,$newline=true)
+ {
+ global $ADODB_FLUSH,$ADODB_OUTP;
+
+diff --git a/lib/bbcode/stringparser.class.php b/lib/bbcode/stringparser.class.php
+index 46f78f3..b0a0619 100644
+--- a/lib/bbcode/stringparser.class.php
++++ b/lib/bbcode/stringparser.class.php
+@@ -1248,7 +1248,7 @@ class StringParser_Node {
+ * @param object $node The node to destroy
+ * @return bool True on success, else false.
+ */
+- function destroyNode (&$node) {
++ static function destroyNode (&$node) {
+ if ($node === null) {
+ return false;
+ }
+diff --git a/lib/smarty/Smarty_Compiler.class.php b/lib/smarty/Smarty_Compiler.class.php
+index f09f8de..a62c624 100644
+--- a/lib/smarty/Smarty_Compiler.class.php
++++ b/lib/smarty/Smarty_Compiler.class.php
+@@ -262,12 +262,20 @@ class Smarty_Compiler extends Smarty {
+ reset($this->_folded_blocks);
+
+ /* replace special blocks by "{php}" */
+- $source_content = preg_replace($search.'e', "'"
++ $source_content = preg_replace_callback($search,
++ function($matches) {
++ return $this->_quote_replace($this->left_delimiter) . 'php'
++ . str_repeat("\n", substr_count($matches[0], "\n"))
++ . $this->_quote_replace($this->right_delimiter);
++ }
++ , $source_content);
++
++ /*$source_content = preg_replace($search.'e', "'"
+ . $this->_quote_replace($this->left_delimiter) . 'php'
+ . "' . str_repeat(\"\n\", substr_count('\\0', \"\n\")) .'"
+ . $this->_quote_replace($this->right_delimiter)
+ . "'"
+- , $source_content);
++ , $source_content);*/
+
+ /* Gather all template tags. */
+ preg_match_all("~{$ldq}\s*(.*?)\s*{$rdq}~s", $source_content, $_match);
+diff --git a/lib/support/GallerySetupUtilities.class b/lib/support/GallerySetupUtilities.class
+index 6a6da7b..4f8cc7e 100644
+--- a/lib/support/GallerySetupUtilities.class
++++ b/lib/support/GallerySetupUtilities.class
+@@ -54,7 +54,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function regenerateSession() {
++ static function regenerateSession() {
+ /* 1. Generate a new session id */
+ $newSessionId = md5(uniqid(substr(rand() . serialize($_REQUEST), 0, 114)));
+ $sessionData = array();
+@@ -84,7 +84,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function areCookiesSupported() {
++ static function areCookiesSupported() {
+ static $areCookiesSupported;
+
+ /* Remember the state since we might unset $_COOKIE */
+@@ -101,7 +101,7 @@ class GallerySetupUtilities {
+ * @return int the number of attempts or false if there was an error
+ * @static
+ */
+- function getLoginAttempts() {
++ static function getLoginAttempts() {
+ /* Init if needed (like from lib/support; upgrader already init'ed) */
+ global $gallery;
+ if (!isset($gallery)) {
+@@ -139,7 +139,7 @@ class GallerySetupUtilities {
+ * @return true on success, false on error
+ * @static
+ */
+- function setLoginAttempts($attempts) {
++ static function setLoginAttempts($attempts) {
+ /* Init if needed (like from lib/support; upgrader already init'ed) */
+ global $gallery;
+ if (!isset($gallery)) {
+@@ -182,7 +182,7 @@ class GallerySetupUtilities {
+ * @param bool $updateDatabase true if you want to also reset the login attempts (default: true)
+ * @static
+ */
+- function authenticateThisSession($resetLoginAttempts=true) {
++ static function authenticateThisSession($resetLoginAttempts=true) {
+ $_SESSION['authenticated'] = true;
+ if ($resetLoginAttempts) {
+ GallerySetupUtilities::setLoginAttempts(0);
+@@ -196,7 +196,7 @@ class GallerySetupUtilities {
+ * @return true if this session is authenticated
+ * @static
+ */
+- function isSessionAuthenticated() {
++ static function isSessionAuthenticated() {
+ return !empty($_SESSION['authenticated']);
+ }
+
+@@ -205,7 +205,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function redirectBackToSelf() {
++ static function redirectBackToSelf() {
+ require_once(dirname(__FILE__) . '/../../modules/core/classes/GalleryUrlGenerator.class');
+ $urlGenerator = new GalleryUrlGenerator();
+ $url = $urlGenerator->getCurrentUrl();
+@@ -224,7 +224,7 @@ class GallerySetupUtilities {
+ * @return string the path to the config dir
+ * @static
+ */
+- function getConfigDir() {
++ static function getConfigDir() {
+ if (defined('GALLERY_CONFIG_DIR')) {
+ return GALLERY_CONFIG_DIR;
+ }
+@@ -237,7 +237,7 @@ class GallerySetupUtilities {
+ * @return array the config values from config.php
+ * @static
+ */
+- function getGalleryConfig() {
++ static function getGalleryConfig() {
+ $gallery = new GallerySetupUtilitiesStub();
+
+ /* Load config.php */
+@@ -256,7 +256,7 @@ class GallerySetupUtilities {
+ * @return string the authentication key
+ * @static
+ */
+- function getAuthenticationKey() {
++ static function getAuthenticationKey() {
+ return isset($_SESSION['authKey']) ? $_SESSION['authKey'] : null;
+ }
+
+@@ -265,7 +265,7 @@ class GallerySetupUtilities {
+ * @param string $key the authentication key
+ * @static
+ */
+- function setAuthenticationKey($key) {
++ static function setAuthenticationKey($key) {
+ $_SESSION['authKey'] = $key;
+ }
+
+@@ -274,7 +274,7 @@ class GallerySetupUtilities {
+ * @param string a random value
+ * @static
+ */
+- function generateAuthenticationKey() {
++ static function generateAuthenticationKey() {
+ for ($len = 64, $rand='';
+ strlen($rand) < $len;
+ $rand .= chr(!mt_rand(0,2) ? mt_rand(48,57) :
+@@ -308,7 +308,7 @@ class GallerySetupUtilities {
+ *
+ * @static
+ */
+- function startSession() {
++ static function startSession() {
+ /* Set our own session name */
+ if (@ini_get('session.auto_start')) {
+ session_unset();
+diff --git a/modules/core/classes/GalleryCoreApi.class b/modules/core/classes/GalleryCoreApi.class
+index 6edcdf4..27d5b20 100644
+--- a/modules/core/classes/GalleryCoreApi.class
++++ b/modules/core/classes/GalleryCoreApi.class
+@@ -295,7 +295,7 @@ class GalleryCoreApi {
+ * @return array GalleryStatus a status code
+ * string a value
+ */
+- function getPluginParameter($pluginType, $pluginId, $parameterName, $itemId=0) {
++ static function getPluginParameter($pluginType, $pluginId, $parameterName, $itemId=0) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+ return GalleryPluginHelper_simple::getParameter($pluginType, $pluginId,
+@@ -363,7 +363,7 @@ class GalleryCoreApi {
+ * 'requiredModuleApi' => array,
+ * 'version' => string)
+ */
+- function fetchPluginStatus($pluginType, $ignoreCache=false) {
++ static function fetchPluginStatus($pluginType, $ignoreCache=false) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+ return GalleryPluginHelper_simple::fetchPluginStatus($pluginType, $ignoreCache);
+@@ -376,7 +376,7 @@ class GalleryCoreApi {
+ * @return array GalleryStatus a status code
+ * array of (pluginId => ('active' => boolean))
+ */
+- function fetchPluginList($pluginType) {
++ static function fetchPluginList($pluginType) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryPluginHelper_simple.class');
+ return GalleryPluginHelper_simple::fetchPluginList($pluginType);
+@@ -2355,7 +2355,7 @@ class GalleryCoreApi {
+ * mixed one GalleryEntity or an array of GalleryEntities
+ * @deprecated $requiredEntityType will no longer be optional after the next major API change
+ */
+- function loadEntitiesById($ids, $requiredEntityType=null) {
++ static function loadEntitiesById($ids, $requiredEntityType=null) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryEntityHelper_simple.class');
+ return GalleryEntityHelper_simple::loadEntitiesById($ids, $requiredEntityType);
+@@ -2708,7 +2708,7 @@ class GalleryCoreApi {
+ * @param string $sourceEncoding source encoding (eg. 'ISO-8859-1'), defaults to system charset
+ * @return string the result
+ */
+- function convertToUtf8($inputString, $sourceEncoding=null) {
++ static function convertToUtf8($inputString, $sourceEncoding=null) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryCharsetHelper_simple.class');
+ return GalleryCharsetHelper_simple::convertToUtf8($inputString, $sourceEncoding);
+@@ -2734,7 +2734,7 @@ class GalleryCoreApi {
+ * @param int $length the length of the substring, not optional
+ * @return string a multibyte safe substring of input value
+ */
+- function utf8Substring($string, $start, $length) {
++ static function utf8Substring($string, $start, $length) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryCharsetHelper_simple.class');
+ return GalleryCharsetHelper_simple::utf8Substring($string, $start, $length);
+@@ -2747,7 +2747,7 @@ class GalleryCoreApi {
+ * @param int $length the length in bytes (not in characters), not optional
+ * @return string a multibyte safe substring of input value
+ */
+- function utf8Strcut($string, $start, $length) {
++ static function utf8Strcut($string, $start, $length) {
+ GalleryCoreApi::requireOnce(
+ 'modules/core/classes/helpers/GalleryCharsetHelper_simple.class');
+ return GalleryCharsetHelper_simple::utf8Strcut($string, $start, $length);
+@@ -2817,7 +2817,7 @@ class GalleryCoreApi {
+ * @param string $file
+ * @param boolean $skipBaseDirectoryDetection deprecated
+ */
+- function requireOnce($file, $skipBaseDirectoryDetection=false) {
++ static function requireOnce($file, $skipBaseDirectoryDetection=false) {
+ static $loaded;
+ if (!isset($loaded[$file])) {
+ $loaded[$file] = 1;
+diff --git a/modules/core/classes/GalleryDataCache.class b/modules/core/classes/GalleryDataCache.class
+index 07f26f4..dd6d5ec 100644
+--- a/modules/core/classes/GalleryDataCache.class
++++ b/modules/core/classes/GalleryDataCache.class
+@@ -40,7 +40,7 @@ class GalleryDataCache {
+ * @staticvar cache the singleton cache
+ * @access private
+ */
+- function &_getCache() {
++ static function &_getCache() {
+ static $cache;
+ if (!isset($cache)) {
+ $cache['maxKeys'] = 800;
+@@ -81,7 +81,7 @@ class GalleryDataCache {
+ * @param mixed $data
+ * @param boolean $protected should this key survive a reset call?
+ */
+- function put($key, $data, $protected=false) {
++ static function put($key, $data, $protected=false) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['memoryCacheEnabled']) {
+ return;
+@@ -182,7 +182,7 @@ class GalleryDataCache {
+ * @param string $key
+ * @return mixed the cached data
+ */
+- function get($key) {
++ static function get($key) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['memoryCacheEnabled']) {
+ return null;
+@@ -199,7 +199,7 @@ class GalleryDataCache {
+ * @param string $key
+ * @return boolean true if the cache contains the key given
+ */
+- function containsKey($key) {
++ static function containsKey($key) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['memoryCacheEnabled']) {
+ return false;
+@@ -268,7 +268,7 @@ class GalleryDataCache {
+ * @param array $pathInfo the path info
+ * @return mixed object data
+ */
+- function &getFromDisk($pathInfo) {
++ static function &getFromDisk($pathInfo) {
+ $null = null;
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['fileCacheEnabled']) {
+@@ -341,7 +341,7 @@ class GalleryDataCache {
+ * @param array $requiredClasses classes that must be loaded in order to retrieve this data
+ * @see GalleryDataCache::getCachePath
+ */
+- function putToDisk($pathInfo, &$data, $requiredClasses=array()) {
++ static function putToDisk($pathInfo, &$data, $requiredClasses=array()) {
+ $cache =& GalleryDataCache::_getCache();
+ if (!$cache['fileCacheEnabled']) {
+ return;
+@@ -373,7 +373,7 @@ class GalleryDataCache {
+ * @param int $id
+ * @return array the tuple
+ */
+- function getCacheTuple($id) {
++ static function getCacheTuple($id) {
+ $id = "$id";
+ if ($id > 100) {
+ return array($id[0], $id[1]);
+@@ -395,7 +395,7 @@ class GalleryDataCache {
+ *
+ * @return string the path
+ */
+- function getCachePath($pathInfo) {
++ static function getCachePath($pathInfo) {
+ global $gallery;
+
+ $base = $gallery->getConfig('data.gallery.cache');
+diff --git a/modules/core/classes/GalleryStorage/GalleryStorageExtras.class b/modules/core/classes/GalleryStorage/GalleryStorageExtras.class
+index 9a12ecd..9214b8c 100644
+--- a/modules/core/classes/GalleryStorage/GalleryStorageExtras.class
++++ b/modules/core/classes/GalleryStorage/GalleryStorageExtras.class
+@@ -190,7 +190,7 @@ class GalleryStorageExtras /* the other half of GalleryStorage */ {
+ $value = $this->_gs->_normalizeValue($row[$i], $memberData[$i], true);
+
+ /* Store the value in the object */
+- $entity->$callbacks[$i] = $value;
++ $entity->{$callbacks[$i]} = $value;
+ $entity->_persistentStatus['originalValue'][$callbacks[$i]] = $value;
+ }
+
+diff --git a/modules/core/classes/GalleryUtilities.class b/modules/core/classes/GalleryUtilities.class
+index 0e394fa..eeae67d 100644
+--- a/modules/core/classes/GalleryUtilities.class
++++ b/modules/core/classes/GalleryUtilities.class
+@@ -43,7 +43,7 @@ class GalleryUtilities {
+ * @param string $filename
+ * @return array the file basename, the file extension
+ */
+- function getFileNameComponents($filename) {
++ static function getFileNameComponents($filename) {
+
+ $pos = strrpos($filename, '.');
+
+@@ -69,7 +69,7 @@ class GalleryUtilities {
+ * @param string $filename
+ * @return array the file extension
+ */
+- function getFileExtension($filename) {
++ static function getFileExtension($filename) {
+ list ($base, $extension) = GalleryUtilities::getFileNameComponents($filename);
+ return $extension;
+ }
+@@ -81,7 +81,7 @@ class GalleryUtilities {
+ * @param string $filename
+ * @return array the file base
+ */
+- function getFileBase($filename) {
++ static function getFileBase($filename) {
+ list ($base, $extension) = GalleryUtilities::getFileNameComponents($filename);
+ return $base;
+ }
+@@ -92,7 +92,7 @@ class GalleryUtilities {
+ * @param boolean $prefix (optional) false to omit Gallery variable prefix (not recommended)
+ * @return array file data
+ */
+- function getFile($key, $prefix=true) {
++ static function getFile($key, $prefix=true) {
+ $file = array();
+ if ($prefix) {
+ $key = GALLERY_FORM_VARIABLE_PREFIX . $key;
+@@ -235,7 +235,7 @@ class GalleryUtilities {
+ * @param one or more string parameters
+ * @return mixed a single string value or many values
+ */
+- function getRequestVariables() {
++ static function getRequestVariables() {
+ $values = array();
+ foreach (func_get_args() as $argName) {
+ $values[] = GalleryUtilities::_getRequestVariable(
+@@ -255,7 +255,7 @@ class GalleryUtilities {
+ * Return all request variables with the Gallery variable prefix.
+ * @return array request variable name => value
+ */
+- function getAllRequestVariables() {
++ static function getAllRequestVariables() {
+ $values = array();
+ $prefixLength = strlen(GALLERY_FORM_VARIABLE_PREFIX);
+ foreach ($_POST as $key => $value) {
+@@ -283,7 +283,7 @@ class GalleryUtilities {
+ * @param one or more string parameters
+ * @return mixed a single string value or many values
+ */
+- function getRequestVariablesNoPrefix() {
++ static function getRequestVariablesNoPrefix() {
+ $values = array();
+ foreach (func_get_args() as $argName) {
+ $values[] = GalleryUtilities::_getRequestVariable($argName);
+@@ -304,7 +304,7 @@ class GalleryUtilities {
+ * @param string $value
+ * @param boolean $prefix (optional) false to omit Gallery variable prefix (not recommended)
+ */
+- function putRequestVariable($key, $value, $prefix=true) {
++ static function putRequestVariable($key, $value, $prefix=true) {
+ if ($prefix) {
+ $key = GALLERY_FORM_VARIABLE_PREFIX . $key;
+ }
+@@ -373,7 +373,7 @@ class GalleryUtilities {
+ * @param array $array the source
+ * @access private
+ */
+- function _internalRemoveRequestVariable($keyPath, &$array) {
++ static function _internalRemoveRequestVariable($keyPath, &$array) {
+ $key = array_shift($keyPath);
+ while (!empty($keyPath)) {
+ if (empty($array[$key])) {
+@@ -401,7 +401,7 @@ class GalleryUtilities {
+ * @param int $count the number of markers to return
+ * @return string
+ */
+- function makeMarkers($count, $markerFragment='?') {
++ static function makeMarkers($count, $markerFragment='?') {
+ if (is_array($count)) {
+ $count = count($count);
+ }
+@@ -427,7 +427,7 @@ class GalleryUtilities {
+ * @param array $options (optional) options to pass to UrlGenerator
+ * @return string a URL
+ */
+- function convertPathToUrl($path, $options=array()) {
++ static function convertPathToUrl($path, $options=array()) {
+ global $gallery;
+ $platform =& $gallery->getPlatform();
+ $dirbase = $platform->realpath(dirname(__FILE__) . '/../../..') . '/';
+@@ -458,7 +458,7 @@ class GalleryUtilities {
+ * @param int $targetHeight (optional) target height, defaults to same as width
+ * @return array(width, height)
+ */
+- function shrinkDimensionsToFit($width, $height, $targetWidth, $targetHeight=null) {
++ static function shrinkDimensionsToFit($width, $height, $targetWidth, $targetHeight=null) {
+ if (!isset($targetHeight)) {
+ $targetHeight = $targetWidth;
+ }
+@@ -499,7 +499,7 @@ class GalleryUtilities {
+ * @param int $precision defaults to zero
+ * @return string rounded value
+ */
+- function roundToString($floatValue, $precision=0) {
++ static function roundToString($floatValue, $precision=0) {
+ return str_replace(',', '.', round($floatValue, $precision));
+ }
+
+@@ -701,7 +701,7 @@ class GalleryUtilities {
+ * @param boolean $adaptForMagicQuotes (optional) false to skip undoing the damage caused
+ * by magic_quotes
+ */
+- function sanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
++ static function sanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
+ if (is_array($value)) {
+ foreach (array_keys($value) as $key) {
+ $newKey = $key;
+@@ -739,7 +739,7 @@ class GalleryUtilities {
+ * @param boolean $adaptForMagicQuotes (optional) false to skip redoing the damage caused
+ * by magic_quotes
+ */
+- function unsanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
++ static function unsanitizeInputValues(&$value, $adaptForMagicQuotes=true) {
+ if (is_array($value)) {
+ foreach (array_keys($value) as $key) {
+ GalleryUtilities::unsanitizeInputValues($value[$key], $adaptForMagicQuotes);
+@@ -763,9 +763,14 @@ class GalleryUtilities {
+ * @param string $string the input string with UTF-8 entities
+ * @return string the UTF-8 string
+ */
+- function unicodeEntitiesToUtf8($string) {
+- $string = preg_replace('/&#([xa-f\d]+);/mei',
+- "GalleryUtilities::unicodeValueToUtf8Value('\\1')", $string);
++ static function unicodeEntitiesToUtf8($string) {
++ $string = preg_replace_callback('/&#([xa-f\d]+);/mi',
++ function($matches) {
++ return GalleryUtilities::unicodeValueToUtf8Value($matches[1]);
++ }
++ , $string);
++ /*$string = preg_replace('/&#([xa-f\d]+);/mei',
++ "GalleryUtilities::unicodeValueToUtf8Value('\\1')", $string);*/
+ return $string;
+ }
+
+@@ -777,7 +782,7 @@ class GalleryUtilities {
+ * @return string a multibyte safe substring of input value
+ * @deprecated Please use GalleryCoreApi::utf8Substring instead
+ */
+- function utf8Substring($string, $start, $length) {
++ static function utf8Substring($string, $start, $length) {
+ return GalleryCoreApi::utf8Substring($string, $start, $length);
+ }
+
+@@ -788,7 +793,7 @@ class GalleryUtilities {
+ * @param int $num the unicode value
+ * @return string the UTF-8 string
+ */
+- function unicodeValueToUtf8Value($num) {
++ static function unicodeValueToUtf8Value($num) {
+ if ($num[0] == 'x') {
+ /* Convert hex to decimal */
+ $num = hexdec(substr($num, 1));
+@@ -870,7 +875,7 @@ class GalleryUtilities {
+ * @return string a single value
+ * @access private
+ */
+- function _getRequestVariable($key) {
++ static function _getRequestVariable($key) {
+ $keyPath = preg_split('/[\[\]]/', $key, -1, PREG_SPLIT_NO_EMPTY);
+ $result = GalleryUtilities::_internalGetRequestVariable($keyPath, $_GET);
+ if (isset($result)) {
+@@ -889,7 +894,7 @@ class GalleryUtilities {
+ * @return the value or null if it does not exist
+ * @access private
+ */
+- function _internalGetRequestVariable($keyPath, $array) {
++ static function _internalGetRequestVariable($keyPath, $array) {
+ $key = array_shift($keyPath);
+ while (!empty($keyPath)) {
+ if (!isset($array[$key])) {
+@@ -1001,7 +1006,7 @@ class GalleryUtilities {
+ * Return the address of the remote host.
+ * @return string the remote host address (or null)
+ */
+- function getRemoteHostAddress() {
++ static function getRemoteHostAddress() {
+ $addr = null;
+ if (isset($_SERVER['REMOTE_ADDR'])) {
+ $addr = $_SERVER['REMOTE_ADDR'];
+@@ -1399,7 +1404,7 @@ class GalleryUtilities {
+ * @param string $key the key in the _SERVER superglobal
+ * @return string the value
+ */
+- function getServerVar($key) {
++ static function getServerVar($key) {
+ if (!isset($_SERVER[$key])) {
+ return null;
+ }
+@@ -1432,7 +1437,7 @@ class GalleryUtilities {
+ * @see Gallery::isEmbedded
+ * @deprecated
+ */
+- function isEmbedded() {
++ static function isEmbedded() {
+ global $gallery;
+ return $gallery->isEmbedded();
+ }
+@@ -1617,7 +1622,7 @@ class GalleryUtilities {
+ * @param string $string
+ * @return string lowercase version of the string
+ */
+- function strToLower($string) {
++ static function strToLower($string) {
+ return strtr($string, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz');
+ }
+
+@@ -1626,7 +1631,7 @@ class GalleryUtilities {
+ * @param string $string
+ * @return string uppercase version of the string
+ */
+- function strToUpper($string) {
++ static function strToUpper($string) {
+ return strtr($string, 'abcdefghijklmnopqrstuvwxyz', 'ABCDEFGHIJKLMNOPQRSTUVWXYZ');
+ }
+
+--
+2.13.1
+