When using composite keys for column names their validation class is not respected.
If i insert a string to into the any of the AsciiType columns the value stored in the database is set to 0, same if default_validation_class is BytesType and any inserts to a IntegerType will yield the ascii value of that number (1 becomes 49, 2 becomes 50 and so on).
<?php
use phpcassa\Connection\ConnectionPool, phpcassa\ColumnFamily;
if ($argc !== 6) {
echo "usage: {$argv[0]} <keyspace> <cf> <row-key> <column-key> <value>\r\n";
exit(1);
}
include 'phpcassa/lib/autoload.php';
$argv[3] = false !== strpos($argv[3], ':') ? explode(':', $argv[3]) : $argv[3];
$argv[4] = explode(':', $argv[4]);
$pool = new ConnectionPool($argv[1], array('127.0.0.1'));
$cf = new ColumnFamily($pool, $argv[2]);
$cf->insert_format = ColumnFamily::ARRAY_FORMAT;
$cf->return_format = ColumnFamily::ARRAY_FORMAT;
$cf->insert($argv[3], array(array($argv[4], $argv[5])));
// usage: php bin/set-column.php TestKS TypeTest comp1:comp2 meta:network test-network
// then list content in cassandra
Point of failure
After some research it seems like ColumnFamily::col_type_dict uses the thrift serialization and phpcassa uses php serialization for the column keys.
This can partly be fixed by adding this line, but it seems that it can't unpack correctly after this.
When using composite keys for column names their validation class is not respected.
If i insert a string to into the any of the AsciiType columns the value stored in the database is set to 0, same if
default_validation_class
is BytesType and any inserts to a IntegerType will yield the ascii value of that number (1 becomes 49, 2 becomes 50 and so on).Cassandra database scheme
Code to reproduce
Point of failure
After some research it seems like
ColumnFamily::col_type_dict
uses the thrift serialization and phpcassa uses php serialization for the column keys. This can partly be fixed by adding this line, but it seems that it can't unpack correctly after this.