Closed ashnazg closed 6 months ago
@ashnazg i think found the problem.
i´ve done an var_dump($dbh->tableInfo('phptest_fk'));
in PHP 7.4.29 and PHP 8.1.12, and the output is exactly the same.
It is a bug in the tests since it is written.
In examineArrayData
is a comparison if ($value == 0 && !$quirks[$quirk_key]['size_from_table'])
.
https://github.com/pear/DB/blob/4efd340ec9eb1da23fa2df60d387c274e9c1100b/tests/driver/16tableinfo.phpt#L147
The problem is, that $value == 0
is always true
in PHP7 if $value
is a string.
So this test will always pass, if $value
is a string, no matter what is written in $value
.
This has changed in PHP8 https://www.php.net/releases/8.0/en.php#saner-string-to-number-comparisons
In PHP8 $value == 0
is false
if $value
is a string.
So i think, this test was always not showing the correct result before PHP8, because it always passes if $value
was a string.
What do you think?
I will do an PR in the next days. But now, it is to late and i go to sleep a little bit. I think, we should fix this before the 1.12.0 release.
Created pull request PHP 8.0 testcase failure #24 @ashnazg
PR looks good to me... ok to close this issue once it merges.
Testcase
tests/driver/16tableinfo.phpt
encounters a failure when run on PHP 8.0, as seen below. The behavior differences appear to be in how the queried table characteristics are interpreted byDB
. The paste below is the runtime output of the testcase... you can visually compare it to the--EXPECT--
section in the PHPT to see what's different.As best I can tell, some
flags
are interpreted differently on 8.0 as compared to PHP7 and PHP5, e.g.flags ... was 'not_null multiple_key group_by' but we expected 'not_null multiple_key'
while also some column characteristics show up differently, e.g.
type ... was 'varchar' but we expected 'string'
I thought at first that maybe the PHP 8.0 behavior should be different based on that test platform's database version (newer?) as compared to the PHP7 and PHP5 platforms, but I don't know that for sure.
@schengawegga , if you are able to research this testcase, see how it acts on your various PHP8 platforms. If you become convinced that the runtime behavior as seen below is correct, then I can adjust this testcase to only run itself against PHP7 and older... and create a sister testcase just for PHP8 and up, that is written to
--EXPECT--
these flag and type differences.RUNTIME OUTPUT FROM THE BUILD: