Bug #63949 [Fbk->NoF]: selects on long varchar fields returns empty with PDO ODBC

From: Date: Sun, 27 Dec 2020 04:22:08 +0000
Subject: Bug #63949 [Fbk->NoF]: selects on long varchar fields returns empty with PDO ODBC
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231259@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63949&edit=1 ID: 63949 Updated by: php-bugs@lists.php.net Reported by: toebs at pubsqrd dot com Summary: selects on long varchar fields returns empty with PDO ODBC -Status: Feedback +Status: No Feedback Type: Bug Package: PDO ODBC Operating System: Amazon Linux PHP Version: 5.4.10 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2020-12-17 13:05:21] cmb@php.net Thanks! That is somewhat helpful to analyze the problem. While I still cannot reproduce, I have at least some clue. Obviously, the retrieval of the column as long data does not work for you. The OP had the same issue, but claimed that it would work with "native" ODBC extension. That extension does basically the same as PDO, but defaults to a length of 4096, while PDO defaults to 256. Increasing that may make sense anyway, but would only mitigate the problem. Actually, the code retrieving the long data doesn't provide diagnostics to understand what really happens, so could you please provide an ODBC trace of running the script? Also, set PDO::ATTR_ERRMODE to PDO::ERRMODE_EXCEPTION to not miss any error information. ------------------------------------------------------------------------ [2020-12-17 08:13:32] hldh214 at gmail dot com This problem in my case does not raise any exception but simply return null on some "large" columns Environment: -------------- php -v PHP 8.0.0 (cli) (built: Nov 24 2020 17:04:03) ( NTS gcc x86_64 ) Copyright (c) The PHP Group Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies build with pdo_odbc: --with-pdo-odbc=unixODBC,/usr database: Vertica Analytic Database v9.2.0-3 Reproduce code: --------------- create table bug_63949 ( A varchar(80) NOT NULL, B tinyint NOT NULL, C varchar(100) NOT NULL, D smallint NOT NULL, E varchar(1024) NOT NULL, F varchar(255) NOT NULL, G varchar(255) NOT NULL, H varchar(1000) NOT NULL, I varchar(100) NOT NULL, J tinyint NOT NULL, K varchar(255) NULL ); insert into bug_63949 values ('A', '1', 'C', '2', 'E', 'F', 'G', 'H', 'I', '3', 'K'); ////////////////////////////////////////////////////////////// <?php // https://bugs.php.net/bug.php?id=63949 // https://stackoverflow.com/q/48685059/6266737 // https://stackoverflow.com/q/42301688/6266737 $sql = "select * from bug_63949;"; $ch = new PDO("odbc:VerticaDSNunixodbc"); $stmt = $ch->prepare($sql); $stmt->execute(); $res = $stmt->fetch(PDO::FETCH_ASSOC); var_dump($res); ////////////////////////////////////////////////////////////// Expected result: ---------------- array(11) { ["A"]=> string(1) "A" ["B"]=> string(1) "1" ["C"]=> string(1) "C" ["D"]=> string(1) "2" ["E"]=> string(1) "E" ["F"]=> string(1) "F" ["G"]=> string(1) "G" ["H"]=> string(1) "H" ["I"]=> string(1) "I" ["J"]=> string(1) "3" ["K"]=> string(1) "K" } Actual result: -------------- array(11) { ["A"]=> string(1) "A" ["B"]=> string(1) "1" ["C"]=> string(1) "C" ["D"]=> string(1) "2" ["E"]=> NULL ["F"]=> NULL ["G"]=> NULL ["H"]=> NULL ["I"]=> NULL ["J"]=> NULL ["K"]=> NULL } My temporary solution: ---------------------- https://stackoverflow.com/a/57820264/6266737 ------------------------------------------------------------------------ [2020-10-11 04:22:09] php-bugs at lists dot php dot net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. ------------------------------------------------------------------------ [2020-09-28 13:54:04] cmb@php.net I cannot reproduce this with current PHP 7.3 and the ODBC Driver 17 for SQL Server. Can anybody else reproduce the segfault with any of the actively supported PHP versions[1]? If so, we need to know which database and ODBC driver, and which version of PHP you are using, and also an ODBC trace of the execution of a well defined script. [1] <https://www.php.net/supported-versions.php> ------------------------------------------------------------------------ [2018-05-30 19:11:52] ivaldo dot oliveira at gmail dot com This problem still exists in version 7.2.2. My column is varchar (300) and my database is the Intersystems Cache. Thanks for help. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=63949 -- Edit this bug report at https://bugs.php.net/bug.php?id=63949&edit=1

« previous php.bugs (#231259) next »