From 1fbdb11b239562af6fc53bb04820179a61359e84 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 5 Jan 2011 23:07:28 +0000 Subject: [PATCH] fixed not working default param of null for _cut_bytes($data,$offset,$len=null), thought it is NOT used without 3. parameter so far --- phpgwapi/inc/class.egw_session_memcache.inc.php | 6 ++++-- phpgwapi/inc/class.global_stream_wrapper.inc.php | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/phpgwapi/inc/class.egw_session_memcache.inc.php b/phpgwapi/inc/class.egw_session_memcache.inc.php index 5e4fb1913e..925672e8eb 100644 --- a/phpgwapi/inc/class.egw_session_memcache.inc.php +++ b/phpgwapi/inc/class.egw_session_memcache.inc.php @@ -240,8 +240,10 @@ class egw_session_memcache if (self::DEBUG > 1) error_log("\n memcache in cutbyte mb $id:$n:".print_r(mb_substr($data,$offset,$len,'ascii'),true)); if (self::DEBUG > 1) error_log("\n memcache in cutbyte norm $id:$n:".print_r(substr($data,$offset,$len),true)); - if (is_null($len)) $len = self::_bytes($data) - $offset; - + if (is_null($len)) + { + return self::$mbstring_func_overload ? mb_substr($data,$offset,self::_bytes($data),'ascii') : substr($data,$offset); + } return self::$mbstring_func_overload ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len); } diff --git a/phpgwapi/inc/class.global_stream_wrapper.inc.php b/phpgwapi/inc/class.global_stream_wrapper.inc.php index 81a0bf7524..1c362f1660 100644 --- a/phpgwapi/inc/class.global_stream_wrapper.inc.php +++ b/phpgwapi/inc/class.global_stream_wrapper.inc.php @@ -125,8 +125,10 @@ class global_stream_wrapper */ private static function _cut_bytes(&$data,$offset,$len=null) { - if (is_null($len)) $len = self::_bytes($data) - $offset; - + if (is_null($len)) + { + return self::$mbstring_func_overload ? mb_substr($data,$offset,self::_bytes($data),'ascii') : substr($data,$offset); + } return self::$mbstring_func_overload ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len); }