Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Fixed
-
Affects Version/s: PHP-8.4.1
-
Fix Version/s: PHP-8.4.1, PHP-Apricot
-
Component/s: PHPDriver
-
Labels:None
Description
Test Build: CUBRID 2008 R4.1 (8.4.1.1018) (64bit release build for linux_gnu)
OS: Linux 64
Description: Return value of cubrid_fetch_lengths method is empty when record number is 1
Repro steps:
1. execute: fetch_lengths_test2.phpt
statements in fetch_lengths_test2.phpt
[php@NC-PL-QA014 _07_fetch]$ cat fetch_lengths_test2.phpt
<?php
$conn = cubrid_connect("localhost", 33113, "phpdb");
cubrid_execute($conn, 'DROP TABLE IF EXISTS fetch_length_tb');
cubrid_execute($conn,"CREATE TABLE fetch_length_tb(c1 int, c2 varchar(20))");
cubrid_execute($conn,"insert into fetch_length_tb(c1,c2) values(1,'varchar1')");
//cubrid_execute($conn,"insert into fetch_length_tb(c1,c2) values(2,'varchar2')");
$result=cubrid_execute($conn,"select * from fetch_length_tb");
$row = cubrid_fetch_row($result);
print_r($row);
$lens = cubrid_fetch_lengths($result);
print_r($lens);
cubrid_disconnect($conn);
print "Finished!\n";
?>
Actual result:
[php@NC-PL-QA014 _07_fetch]$ php fetch_lengths_test2.phpt
Array
(
[0] => 1
[1] => varchar1
)
Finished!
Expect result:
Array
(
[0] => 1
[1] => varchar1
)
Array
(
[0] => 1
[1] => 8
)
Finished!
Hello!
cubrid_fetch_lengths will return an numeric array with the lengths of the values of each field from the current row of the result set.
In the test scenario, there is only one row in the table. After cubrid_fetch_row, there are no more rows in the table, so cubrid_fetch_lengths will return FALSE. There are no problem with the output.