Closed cebe closed 7 years ago
looks like HHVM Postgres driver does not work correctly with binary columns... https://travis-ci.org/yiisoft/yii2/jobs/239526225#L1096
42) yiiunit\framework\rbac\PgSQLManagerTest::testRemoveAllPermissions
yii\db\Exception: SQLSTATE[42601]: Syntax error: 7 FEHLER: Syntaxfehler bei »\«
LINE 1: ..., "created_at", "updated_at") VALUES ('isAuthor', \x4f3a3333...
^
The SQL being executed was: INSERT INTO "auth_rule" ("name", "data", "created_at", "updated_at") VALUES ('isAuthor', :qp1, 1496659933, 1496659933)
/home/cebe/dev/yiisoft/yii2/framework/db/Schema.php:636
/home/cebe/dev/yiisoft/yii2/framework/db/Command.php:852
/home/cebe/dev/yiisoft/yii2/framework/rbac/DbManager.php:359
/home/cebe/dev/yiisoft/yii2/framework/rbac/BaseManager.php:127
/home/cebe/dev/yiisoft/yii2/tests/framework/rbac/ManagerTestCase.php:209
/home/cebe/dev/yiisoft/yii2/tests/framework/rbac/ManagerTestCase.php:442
/home/cebe/dev/yiisoft/yii2/vendor/phpunit/phpunit/phpunit:47
binary value is not properly quoted by HHVM PDO pgsql driver. I did not find a way to fix this. Neither passing it as as string, nor as a stream works. I tried this patch but it does not solve the problem:
diff --git a/framework/db/pgsql/QueryBuilder.php b/framework/db/pgsql/QueryBuilder.php
index 54fcfb7..b70d307 100644
--- a/framework/db/pgsql/QueryBuilder.php
+++ b/framework/db/pgsql/QueryBuilder.php
@@ -267,12 +267,16 @@ class QueryBuilder extends \yii\db\QueryBuilder
if ($columns instanceof \yii\db\Query) {
return $columns;
}
-
if (($tableSchema = $this->db->getSchema()->getTableSchema($table)) !== null) {
$columnSchemas = $tableSchema->columns;
foreach ($columns as $name => $value) {
if (isset($columnSchemas[$name]) && $columnSchemas[$name]->type === Schema::TYPE_BINARY && is_string($value)) {
- $columns[$name] = [$value, \PDO::PARAM_LOB]; // explicitly setup PDO param type for binary column
+ if (defined('HHVM_VERSION')) {
+ // passing binary data as strings is broken on HHVM pgsql extension
+ $columns[$name] = [fopen('data://text/plain;base64,' . base64_encode($value),'r'), \PDO::PARAM_LOB];
+ } else {
+ $columns[$name] = [$value, \PDO::PARAM_LOB]; // explicitly setup PDO param type for binary column
+ }
}
}
}
As far as I see, the problem needs to be fixed in HHVM PDO driver. Skipping the test for now (226f524da369b67a35f697c887eb07f9b99d610c).
could be the same as https://github.com/yiisoft/yii2/issues/13010
HHVM support is dropped. #14178
https://travis-ci.org/yiisoft/yii2/jobs/238664249#L830