Alice
Alice

Reputation: 144

Cassandra exception error - who do know solution?

I use in my development php evseevnn/php-cassandra-binary. At last time I got always exception:

<h4>A PHP Error was encountered</h4>

<p>Severity: User Notice</p>
<p>Message:  Reading while at end of stream</p>
<p>Filename: Response/Rows.php</p>
<p>Line Number: 65</p>

I saw ar file Response/Rows.php at line 65. There is here:

  public function current() {
            if (!isset($this->rows[$this->current])) {
                throw new \OutOfRangeException('Invalid index');
            }
            $row = $this->rows[$this->current];
            for ($i = 0; $i < $this->columnCount; ++$i) {
                try {
                    $data = new DataStream($this->rows[$this->current][$this->columns[$i]['name']]);
                    $row[$this->columns[$i]['name']] = $data->readByType($this->columns[$i]['type']);
                } catch (\Exception $e) {
                    trigger_error($e->getMessage()); // Line 65
                    $row[$this->columns[$i]['name']] = null;
                }
            }
            return $row;
        }

Could you help me to resolve this error and to understand why does it happend? Maybe to write a issue at Github to developer? https://github.com/evseevnn/php-cassandra-binary

Upvotes: 1

Views: 264

Answers (2)

Rabbit
Rabbit

Reputation: 314

There is an issue with NULL values and maps columns. https://github.com/evseevnn/php-cassandra-binary/issues/27

I used the development branch of https://github.com/eyeem/php-cassandra-binary/tree/develop and replaced the DataStream.php by https://github.com/eyeem/php-cassandra-binary/blob/master/src/Protocol/Response/DataStream.php

After that everything worked fine.

Upvotes: 2

edlerd
edlerd

Reputation: 2145

looks like $this->columnCount is not set correctly, when calling the pasted function.

Upvotes: 1

Related Questions