Bug #71667 [Opn->Csd]: "computed" column name behavior is inconsistent with mssql extension
| From: | ab@php.net | Date: | Mon, 29 Feb 2016 15:43:16 +0000 |
| Subject: | Bug #71667 [Opn->Csd]: "computed" column name behavior is inconsistent with mssql extension | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-199526@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71667&edit=1
ID: 71667
Updated by: ab@php.net
Reported by: adam dot baratz at gmail dot com
Summary: "computed" column name behavior is inconsistent with
mssql extension
-Status: Open
+Status: Closed
Type: Bug
Package: PDO DBlib
Operating System: Linux
PHP Version: 5.6.19RC1
-Assigned To:
+Assigned To: ab
Block user comment: N
Private report: N
New Comment:
The leak fix is applied, see the PR page for more info.
Thanks.
Previous Comments:
------------------------------------------------------------------------
[2016-02-25 23:20:12] adam dot baratz at gmail dot com
Description:
------------
The output is inconsistent with the output from executing the same query using the mssql extension
(see expected result section for details).
Test script:
---------------
<?php
if (!extension_loaded('pdo_dblib')) {
die('skip not loaded');
}
require dirname(__FILE__) . '/config.inc';
$stmt = $db->prepare('SELECT 1, 2 AS named, 3');
$stmt->execute();
var_dump($stmt->fetch());
Expected result:
----------------
The mssql extension starts "computed" names at "computed" and uses a sequence to
name subsequent columns, not the column number:
https://github.com/php/php-src/blob/PHP-5.6.19/ext/mssql/php_mssql.c#L1225
In this case, the first column should be "computed" and the third should be
"computed1."
Additionally, debug mode should not be reporting memory leaks.
Actual result:
--------------
---------------------------------------
/vagrant/pdo_dblib-clean/dblib_stmt.c(106) : Block 0x00000000 status:
NULL
---------------------------------------
array(6) {
["computed0"]=>
string(1) "1"
[0]=>
string(1) "1"
["named"]=>
string(1) "2"
[1]=>
string(1) "2"
["computed2"]=>
string(1) "3"
[2]=>
string(1) "3"
}
[Thu Feb 25 23:04:41 2016] Script: '/vagrant/pdo_dblib-clean/tests/timeout.php'
/home/vagrant/php-src/main/spprintf.c(245) : Freeing 0x7F1E9FB6B518 (79 bytes),
script=/vagrant/pdo_dblib-clean/tests/timeout.php
Last leak repeated 1 time
[Thu Feb 25 23:04:41 2016] Script: '/vagrant/pdo_dblib-clean/tests/timeout.php'
/vagrant/pdo_dblib-clean/dblib_stmt.c(211) : Freeing 0x7F1E9FB6D270 (6 bytes),
script=/vagrant/pdo_dblib-clean/tests/timeout.php
=== Total 3 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71667&edit=1