php-src icon indicating copy to clipboard operation
php-src copied to clipboard

make test fail while pdo_mysql build

Open evrinoma opened this issue 4 years ago • 5 comments

Description

I have faced with similar problem in pdo_mysql too while building and testing mentioned here

and here is fix sed -i -e "s@'/ext/pdo/tests'@'/../../ext/pdo/tests'@g" /usr/src/php/ext/pdo_mysql/tests/common.phpt

but actually I've got a two unpassed tests in pdo_mysql

bug_38546.log in (PHP 7.4.29) Resulted in this output:

---- EXPECTED OUTPUT
ok insert
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => -23
    [3] => -23
)
ok prepare 1
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 1
    [1] => 1
    [some_bool_2] => 0
    [2] => 0
    [some_int] => 1
    [3] => 1
)
ok prepare 2
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => 2
    [3] => 2
)

Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'true' for column 'some_bool_1' at row 1 in %s
array(3) {
  [0]=>
  string(5) "HY000"
  [1]=>
  int(1366)
  [2]=>
  string(65) "Incorrect integer value: 'true' for column 'some_bool_1' at row 1"
}
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => 2
    [3] => 2
)

Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'some_bool_2' cannot be null in %s
array(3) {
  [0]=>
  string(5) "23000"
  [1]=>
  int(1048)
  [2]=>
  string(35) "Column 'some_bool_2' cannot be null"
}
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => 2
    [3] => 2
)
ok prepare 5
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 1
    [1] => 1
    [some_bool_2] => 0
    [2] => 0
    [some_int] => 5
    [3] => 5
)
---- ACTUAL OUTPUT
ok insert
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => -23
    [3] => -23
)
ok prepare 1
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 1
    [1] => 1
    [some_bool_2] => 0
    [2] => 0
    [some_int] => 1
    [3] => 1
)
ok prepare 2
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => 2
    [3] => 2
)

Warning: PDOStatement::execute(): SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'true' for column `test`.`test`.`some_bool_1` at row 1 in /usr/src/php/ext/pdo_mysql/tests/bug_38546.php on line 113
array(3) {
  [0]=>
  string(5) "22007"
  [1]=>
  int(1366)
  [2]=>
  string(79) "Incorrect integer value: 'true' for column `test`.`test`.`some_bool_1` at row 1"
}
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => 2
    [3] => 2
)

Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'some_bool_2' cannot be null in /usr/src/php/ext/pdo_mysql/tests/bug_38546.php on line 140
array(3) {
  [0]=>
  string(5) "23000"
  [1]=>
  int(1048)
  [2]=>
  string(35) "Column 'some_bool_2' cannot be null"
}
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 0
    [1] => 0
    [some_bool_2] => 1
    [2] => 1
    [some_int] => 2
    [3] => 2
)
ok prepare 5
Array
(
    [uid] => 6
    [0] => 6
    [some_bool_1] => 1
    [1] => 1
    [some_bool_2] => 0
    [2] => 0
    [some_int] => 5
    [3] => 5
)
---- FAILED

diff showing next

1c1
< ---- EXPECTED OUTPUT
---
> ---- ACTUAL OUTPUT
39c39
< Warning: PDOStatement::execute(): SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'true' for column 'some_bool_1' at row 1 in %s
---
> Warning: PDOStatement::execute(): SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'true' for column `test`.`test`.`some_bool_1` at row 1 in /usr/src/php/ext/pdo_mysql/tests/bug_38546.php on line 113
42c42
<   string(5) "HY000"
---
>   string(5) "22007"
46c46
<   string(65) "Incorrect integer value: 'true' for column 'some_bool_1' at row 1"
---
>   string(79) "Incorrect integer value: 'true' for column `test`.`test`.`some_bool_1` at row 1"
60c60
< Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'some_bool_2' cannot be null in %s
---
> Warning: PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'some_bool_2' cannot be null in /usr/src/php/ext/pdo_mysql/tests/bug_38546.php on line 140
91a92
> ---- FAILED

and next unpassed test pdo_mysql___construct.log in (PHP 8.1.5 PHP 7.4.29)

---- EXPECTED OUTPUT
[002] invalid data source name, [n/a] n/a
[003] invalid data source name, [n/a] n/a
[004] invalid data source name, [n/a] n/a
[005] invalid data source name, [n/a] n/a
[006] invalid data source name, [n/a] n/a
[007] could not find driver, [n/a] n/a
[009] SQLSTATE[%s] [1045] Access denied for user 'dont%s'@'%s' (using password: YES), [n/a] n/a
[017] DSN=%s, SQLSTATE[%s] [%d] %s
done!
---- ACTUAL OUTPUT
[002] invalid data source name, [n/a] n/a
[003] invalid data source name, [n/a] n/a
[004] invalid data source name, [n/a] n/a
[005] invalid data source name, [n/a] n/a
[006] invalid data source name, [n/a] n/a
[007] could not find driver, [n/a] n/a
[009] SQLSTATE[HY000] [1045] Access denied for user 'dontcreatesuchauser'@'php74.src.docker_virt' (using password: YES), [n/a] n/a
[015] DSN=mysql:host=localhostinvalid;dbname=test;host=localhost, SQLSTATE[HY000] [2002] No such file or directory
[017] DSN=mysql:host=-;dbname=test;host=localhost, SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Name or service not known
done!
---- FAILED

Module was build by next instructions set:

cd /usr/src/php/ext/pdo_mysql && phpize && ./configure && cp /usr/local/php/modules/pdo.so modules/ && sed -i -e "s@-d extension_dir=\$(top_builddir)\/modules\/@-d extension_dir=\$(top_builddir)\/modules\/ -d extension=\"pdo.so\" @g" /usr/src/php/ext/pdo_mysql/Makefile && sed -i -e "s@'/ext/pdo/tests'@'/../../ext/pdo/tests'@g" /usr/src/php/ext/pdo_mysql/tests/common.phpt  && make && export PDO_MYSQL_TEST_DSN='mysql:host=172.18.2.1;dbname=test' PDO_MYSQL_TEST_USER='root' PDO_MYSQL_TEST_PASS='1234' && make test

PHP Version

PHP 8.1.5 PHP 7.4.29

Operating System

REHL

SQL engine version

mariadb 10.3.27

evrinoma avatar Apr 22 '22 10:04 evrinoma

This is basically the same issue as #8419; thus I'm closing this as duplicate.

cmb69 avatar Apr 22 '22 12:04 cmb69

It is looks like similar, but what about format output. The format output expected and actual are different

evrinoma avatar Apr 22 '22 12:04 evrinoma

The format output expected and actual are different

Ah, right. Re-opening.

cmb69 avatar Apr 22 '22 13:04 cmb69

bug_38546.log in (PHP 7.4.29)

Does the test also fail with PHP 8.0 and/or 8.1? Otherwise it is moot to have a closer look, since PHP 7.4 is no longer actively supported.

pdo_mysql___construct.log in (PHP 8.1.5 PHP 7.4.29)

Apparently, the failure is:

[015] DSN=mysql:host=localhostinvalid;dbname=test;host=localhost, SQLSTATE[HY000] [2002] No such file or directory

I cannot reproduce this with MySQL (neither 5.6 nor 8.0). Which database server do you use?

cmb69 avatar Apr 22 '22 15:04 cmb69

SQL engine version mariadb 10.3.27

evrinoma avatar Apr 22 '22 16:04 evrinoma