From 25e426a51be978ded7ab4423ceefc64590d7b18c Mon Sep 17 00:00:00 2001 From: David Olivier Date: Sat, 17 Mar 2007 10:53:47 +0000 Subject: [PATCH] Fix for array_shift bug that affects some php versions. git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2588 b72ed6b6-b9f8-46b5-92b4-906544132732 --- classes/php-gettext/gettext.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/classes/php-gettext/gettext.php b/classes/php-gettext/gettext.php index f2dffb8b22b..6cc311fe68f 100644 --- a/classes/php-gettext/gettext.php +++ b/classes/php-gettext/gettext.php @@ -60,7 +60,7 @@ class gettext_reader { * @access private * @return Integer from the Stream */ - function readint() { + /*function readint() { if ($this->BYTEORDER == 0) { // low endian return array_shift(unpack('V', $this->STREAM->read(4))); @@ -68,7 +68,19 @@ function readint() { // big endian return array_shift(unpack('N', $this->STREAM->read(4))); } - } + }*/ + // Fix for array_shift bug affecting some php versions + function readint() { + if ($this->BYTEORDER == 0) { + // low endian + $low_end = unpack('V', $this->STREAM->read(4)); + return array_shift($low_end); + } else { + // big endian + $big_end = unpack('N', $this->STREAM->read(4)); + return array_shift($big_end); + } + } /** * Reads an array of Integers from the Stream