Bug 1390201

Summary: php-mssql segmentation fault
Product: [Fedora] Fedora EPEL Reporter: Toni Spets <toni.spets>
Component: php-extrasAssignee: Remi Collet <fedora>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: epel7CC: dmitry, fedora, menthos
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: php-extras-5.4.16-7.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-25 02:52:25 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Toni Spets 2016-10-31 13:34:06 UTC
Description of problem:

Any query attempted with PDO dblib adapter causes a segmentation fault.

Version-Release number of selected component (if applicable):

php-mssql-5.4.16-5.el7.x86_64

How reproducible:

Every time with a working connection to SQL Server.

Steps to Reproduce:

$db = new PDO('dblib:host=<host>;dbname=<db>', 'user', 'pass');
$db->query('SELECT 1');


Actual results:

Segmentation fault.


Expected results:


Additional info:

Previous version php-mssql-5.4.16-4.el7.x86_64 works fine.

The reason is probably the backported patch in https://bugzilla.redhat.com/show_bug.cgi?id=1381442

Comment 1 Toni Spets 2016-11-07 06:51:43 UTC
This bug is critical and makes the MSSQL adapter completely unusable. Can someone please look at this issue?

Comment 2 Christian Rose 2016-11-08 09:28:05 UTC
I can confirm that with php-mssql-5.4.16-5.el7.x86_64 we get segmentation faults on several servers with sites that connect to a SQL Server cluster.

Downgrading to the previous working version php-mssql-5.4.16-4.el7.x86_64 completely solved the issue and has made the crashes go away.

Comment 3 Remi Collet 2016-11-08 09:32:40 UTC
I was able to reproduce the segfault:

Simple connection test:
# php /tmp/pdo_dblib.php 
+ Connection
+ Query
+ Result
Array
(
    [0] => Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64) 
	Jun 28 2012 08:36:30 
	Copyright (c) Microsoft Corporation
	Express Edition with Advanced Services (64-bit) on Windows NT 6.1 <X64> (Build 7600: ) (Hypervisor)

)
Erreur de segmentation (core dumped)


Simple way is to sync this extension with upstream latest version

http://pkgs.fedoraproject.org/cgit/rpms/php-extras.git/commit/?h=epel7&id=3ac6953c403bc94b27a0e295c61d834c8e77784c


I don't encounter anymore segfault, and

# pear run-tests tests
Running 7 tests
PASS PDO_DBLIB driver does not support transactions[tests/bug_38955.phpt]
FAIL PDO_DBLIB: Does not support get column meta[tests/bug_45876.phpt]
PASS PDO_DBLIB: Quoted field names[tests/bug_47588.phpt]
PASS PDO_DBLIB: Out of memory on large recordsets[tests/bug_50755.phpt]
PASS PDO_DBLIB: Does not force correct dateformat[tests/bug_54648.phpt]
PASS PDO_DBLIB bug #68957 PDO::query doesn't support several queries[tests/bug_68957.phpt]
PASS PDO_DBLIB: Segmentation fault on pdo_dblib::nextRowset[tests/bug_69757.phpt]

# cat tests/bug_45876.diff
001- array(8) {
001+ array(10) {
012-   ["name"]=>
012+   ["native_type_id"]=>
013-   string(13) "TABLE_CATALOG"
013+   int(47)
014-   ["len"]=>
014+   ["native_usertype_id"]=>
015-   int(255)
015+   int(2)
016-   ["pdo_type"]=>
016+   ["name"]=>
017-   int(2)
017+   string(13) "TABLE_CATALOG"
018- }
018+   ["len"]=>
019+   int(255)
020+   ["pdo_type"]=>
021+   int(2)
022+ }

Only additional info, seems ok.

Comment 4 Toni Spets 2016-11-08 09:37:05 UTC
If you can get a Koji build I can test if it still segfaults on my end.

Comment 5 Fedora Update System 2016-11-08 09:43:24 UTC
php-extras-5.4.16-6.el7 has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-f876dc4049

Comment 6 Toni Spets 2016-11-08 10:01:12 UTC
Gave karma on Bodhi, works for me at least. Thanks for fixing it in a timely manner after the nudge!

Comment 7 Fedora Update System 2016-11-10 04:20:16 UTC
php-extras-5.4.16-7.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2016-f876dc4049

Comment 8 Fedora Update System 2016-11-25 02:52:25 UTC
php-extras-5.4.16-7.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.