* Reads a string. * * @return string */
()
| 160 | * @return string |
| 161 | */ |
| 162 | public function readString() |
| 163 | { |
| 164 | $com = ""; |
| 165 | while (($d = $this->read()) != chr(0)) |
| 166 | { |
| 167 | $com .= $d; |
| 168 | $sUnread = substr($this->buffer, $this->bpos); |
| 169 | $sBeforeZero = strstr($sUnread, chr(0), true); |
| 170 | |
| 171 | if ($sBeforeZero === false) |
| 172 | { |
| 173 | $com .= $sUnread; |
| 174 | $this->bpos = $this->bsize; |
| 175 | } |
| 176 | else |
| 177 | { |
| 178 | $iLen = strlen($sBeforeZero); |
| 179 | if ($iLen > 0) |
| 180 | { |
| 181 | $com .= $sBeforeZero; |
| 182 | $this->bpos += $iLen; |
| 183 | } |
| 184 | } |
| 185 | } |
| 186 | return $com; |
| 187 | } |
| 188 | |
| 189 | /** |
| 190 | * Was the last command/query successful? |