diff --git a/src/Zend/Io/Reader.php b/src/Zend/Io/Reader.php
index 8170052..444b98b 100644
--- a/src/Zend/Io/Reader.php
+++ b/src/Zend/Io/Reader.php
@@ -570,7 +570,11 @@ class Zend_Io_Reader
}
}
- return substr($value, -2) == "\0\0" ? substr($value, 0, -2) : $value;
+ while (substr($value, -2) == "\0\0") {
+ $value = substr($value, 0, -2);
+ }
+
+ return $value;
}
/**
diff --git a/src/Zend/Io/StringWriter.php b/src/Zend/Io/StringWriter.php
index 6ce98b7..b743a2f 100644
--- a/src/Zend/Io/StringWriter.php
+++ b/src/Zend/Io/StringWriter.php
@@ -69,6 +69,9 @@ class Zend_Io_StringWriter extends Zend_Io_Writer
*/
public function toString()
{
+ if ($this->getSize() == 0) {
+ return '';
+ }
$offset = $this->getOffset();
$this->setOffset(0);
$data = fread($this->getFileDescriptor(), $this->getSize());
diff --git a/src/Zend/Io/Writer.php b/src/Zend/Io/Writer.php
index 1de4c75..9359f7c 100644
--- a/src/Zend/Io/Writer.php
+++ b/src/Zend/Io/Writer.php
@@ -492,7 +492,7 @@ class Zend_Io_Writer
* @throws Zend_Io_Exception if length attribute is negative or
* if the stream is closed
*/
- public final function writeHHex($length)
+ public final function writeHHex($value)
{
return $this->write(pack('H*', $value));
}
@@ -506,7 +506,7 @@ class Zend_Io_Writer
* @throws Zend_Io_Exception if length attribute is negative or
* if the stream is closed
*/
- public final function writeLHex($length)
+ public final function writeLHex($value)
{
return $this->write(pack('h*', $value));
}
@@ -519,7 +519,7 @@ class Zend_Io_Writer
* @return Zend_Io_Writer
* @throws Zend_Io_Exception if the stream is closed
*/
- public final function writeGuid()
+ public final function writeGuid($value)
{
$string = '';
$C = preg_split('/-/', $value);