yiisoft / yii2

Yii 2: The Fast, Secure and Professional PHP Framework
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
14.24k stars 6.91k forks source link

HHVM tests are failing on master #14244

Closed cebe closed 7 years ago

cebe commented 7 years ago

https://travis-ci.org/yiisoft/yii2/jobs/238664249#L830

cebe commented 7 years ago

looks like HHVM Postgres driver does not work correctly with binary columns... https://travis-ci.org/yiisoft/yii2/jobs/239526225#L1096

cebe commented 7 years ago
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).

cebe commented 7 years ago

related: https://github.com/yiisoft/yii2/commit/23790272dc561aacf2070cbbda396f49e44cbb7d , https://github.com/yiisoft/yii2/commit/6b607d078f415ae1eb5fb12305f6577044b83370 (#11498)

cebe commented 7 years ago

could be the same as https://github.com/yiisoft/yii2/issues/13010

SilverFire commented 7 years ago

Related https://github.com/yiisoft/yii2/commit/5c6ba33e553476cddd468df0ef9b99a00d7e0411

SilverFire commented 7 years ago

HHVM support is dropped. #14178