evseevnn-zz / php-cassandra-binary

PHP library for Cassandra database via a binary protocol.
http://evseevnn.github.io/php-cassandra-binary/
MIT License
69 stars 33 forks source link

Warning: unpack(): Type l: not enough input #35

Open penfold45 opened 10 years ago

penfold45 commented 10 years ago

Hi I just pulled the latest version of dev-master and I now get this error

Warning: unpack(): Type l: not enough input, need 4, have 0 in vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/DataStream.php on line 77

When I run a pretty simple CQL query

SELECT * FROM basket WHERE global_id = :global_id AND tag = :tag ORDER BY id,hotel_id, room_id

I tried to debug it but got a bit lost in what is going on in there.

LarsFronius commented 10 years ago

Thanks for opening the issue. Can you tell me what data types you have inserted and also what data was inserted so I can write a regression test and patch?

penfold45 commented 10 years ago

Hi yeh there is no data at all. It is empty and the structure is

CREATE TABLE basket (                                                                                                                                                                                                                                          
                 id uuid,                                                                                                                                                                                                                                                      
                 tag text,                                                                                                                                                                                                                                                
                 global_id text,                                                                                                                                                                                                                                               
                 hotel_id int,                                                                                                                                                                                                                                                 
                 room_id int,                                                                                                                                                                                                                                                  
                 date_from text,                                                                                                                                                                                                                                               
                 date_to text,                                                                                                                                                                                                                                                 
                 adults int,                                                                                                                                                                                                                                                   
                 number_of_children int,                                                                                                                                                                                                                                                                                                                                                                                                                                                                               
                 PRIMARY KEY ( (tag, global_id), id, hotel_id, room_id, date_from, date_to)
LarsFronius commented 10 years ago

It's true, that there are issues with empty fields. Check https://github.com/evseevnn/php-cassandra-binary/pull/33 as well. I'm gonna check for your case what is going on.

andreassolberg commented 10 years ago

I'm getting the same error, with a very simple query:

$data = $database->query('SELECT * FROM "client" WHERE "id" = :id', ['id' => 'a5b9491e-372d-49d9-943c-63d40dcb67f4']);

I am getting the data I need, but I get this warning:

Warning: unpack(): Type l: not enough input, need 4, have 1 in /var/www/cassa/vendor/evseevnn/php-cassandra-binary/src/Protocol/Response/DataStream.php on line 77

andreassolberg commented 10 years ago

I've found the cause of this issue. It is introduced in 6f1cae97b206dd8cc412553fb08ba568c725253b

Please revert this patch. Until then I have to rely on:

    "require": {
        "evseevnn/php-cassandra-binary": "dev-master#31fa28eb756e5d06470a1e4ae4698d44250231b8"
    }