fixed not working default param of null for _cut_bytes($data,$offset,$len=null), thought it is NOT used without 3. parameter so far

This commit is contained in:
Ralf Becker 2011-01-05 22:50:22 +00:00
parent 5382856b60
commit 8935a2d0a2
2 changed files with 4 additions and 0 deletions

View File

@ -240,6 +240,8 @@ 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 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 (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;
return self::$mbstring_func_overload ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len); return self::$mbstring_func_overload ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len);
} }

View File

@ -125,6 +125,8 @@ class global_stream_wrapper
*/ */
private static function _cut_bytes(&$data,$offset,$len=null) private static function _cut_bytes(&$data,$offset,$len=null)
{ {
if (is_null($len)) $len = self::_bytes($data) - $offset;
return self::$mbstring_func_overload ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len); return self::$mbstring_func_overload ? mb_substr($data,$offset,$len,'ascii') : substr($data,$offset,$len);
} }