Fix small bugs

git-svn-id: http://php-reader.googlecode.com/svn/branches/zend@169 51a70ab9-7547-0410-9469-37e369ee0574
This commit is contained in:
svollbehr
2010-03-06 18:17:56 +00:00
parent ebe67fdf7f
commit 089c866bc2
3 changed files with 11 additions and 4 deletions

View File

@@ -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;
} }
/** /**

View File

@@ -69,6 +69,9 @@ class Zend_Io_StringWriter extends Zend_Io_Writer
*/ */
public function toString() public function toString()
{ {
if ($this->getSize() == 0) {
return '';
}
$offset = $this->getOffset(); $offset = $this->getOffset();
$this->setOffset(0); $this->setOffset(0);
$data = fread($this->getFileDescriptor(), $this->getSize()); $data = fread($this->getFileDescriptor(), $this->getSize());

View File

@@ -492,7 +492,7 @@ class Zend_Io_Writer
* @throws Zend_Io_Exception if <var>length</var> attribute is negative or * @throws Zend_Io_Exception if <var>length</var> attribute is negative or
* if the stream is closed * if the stream is closed
*/ */
public final function writeHHex($length) public final function writeHHex($value)
{ {
return $this->write(pack('H*', $value)); return $this->write(pack('H*', $value));
} }
@@ -506,7 +506,7 @@ class Zend_Io_Writer
* @throws Zend_Io_Exception if <var>length</var> attribute is negative or * @throws Zend_Io_Exception if <var>length</var> attribute is negative or
* if the stream is closed * if the stream is closed
*/ */
public final function writeLHex($length) public final function writeLHex($value)
{ {
return $this->write(pack('h*', $value)); return $this->write(pack('h*', $value));
} }
@@ -519,7 +519,7 @@ class Zend_Io_Writer
* @return Zend_Io_Writer * @return Zend_Io_Writer
* @throws Zend_Io_Exception if the stream is closed * @throws Zend_Io_Exception if the stream is closed
*/ */
public final function writeGuid() public final function writeGuid($value)
{ {
$string = ''; $string = '';
$C = preg_split('/-/', $value); $C = preg_split('/-/', $value);