php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77747 Segmentation fault with curl
Submitted: 2019-03-15 15:35 UTC Modified: 2019-03-15 18:20 UTC
From: anthony dot martin at sensiolabs dot com Assigned:
Status: Duplicate Package: cURL related
PHP Version: 7.2.16 OS: Ubuntu 18.10
Private report: No CVE-ID: None
 [2019-03-15 15:35 UTC] anthony dot martin at sensiolabs dot com
Description:
------------
A segmentation fault error occcurs, only, when I try to unit test some experimental feature in the Symfony Framework.

I've tried with different version of curl.

PHP version :
PHP 7.2.15-0ubuntu0.18.10.1 (cli) (built: Feb  8 2019 14:54:22) ( NTS )
Zend Engine v3.2.0
    with Zend OPcache v7.2.15-0ubuntu0.18.10.1
    with Xdebug v2.6.0

Curl version : 
curl 7.63.0 (x86_64-pc-linux-gnu) libcurl/7.61.0 OpenSSL/1.1.1 zlib/1.2.11 libidn2/2.0.5 libpsl/0.20.2 (+libidn2/2.0.4) nghttp2/1.32.1 librtmp/2.3
Release-Date: 2018-12-12
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smb smbs smtp smtps telnet tftp 
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz TLS-SRP HTTP2 UnixSockets HTTPS-proxy PSL 


Test script:
---------------
How to reproduce (You will need composer) :
1- Fork the Symfony repository at : https://github.com/symfony/symfony
2- Be sure to be on the master branch.
3- Run inside the repository, the following command : `composer install`
4- Run inside the repository, the following command : `./phpunit src/Symfony/Component/HttpClient/Tests/`
5- You should see the segmentation fault error.

More info : 
If you comment the lines 78 to 80 in the src/Symfony/Component/HttpClient/CurlHttpClient.php and re-run the previous phpunit command, the segmentation fault disappear.

Expected result:
----------------
#!/usr/bin/env php
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing src/Symfony/Component/HttpClient/Tests/
...............................................................  63 / 199 ( 31%)
............................................................... 126 / 199 ( 63%)
............................................................... 189 / 199 ( 94%)
..........                                                      199 / 199 (100%)

Time: 12.74 seconds, Memory: 8.00MB

OK (199 tests, 423 assertions)

Actual result:
--------------
#!/usr/bin/env php
PHPUnit 6.5.14 by Sebastian Bergmann and contributors.

Testing src/Symfony/Component/HttpClient/Tests/
Erreur de segmentation

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-03-15 15:41 UTC] danack@php.net
-Status: Open +Status: Feedback
 [2019-03-15 15:41 UTC] danack@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Please provide the backtrace if you have this happening in front of you
 [2019-03-15 15:49 UTC] anthony dot martin at sensiolabs dot com
-Status: Feedback +Status: Open
 [2019-03-15 15:49 UTC] anthony dot martin at sensiolabs dot com
Hi,
Here is the backtrace that you ask. Not sure if it can really help you.

Backtrace :
-----------

#0  0x00005606e8b71718 in _emalloc ()
#1  0x00005606e8ba7712 in _zend_hash_next_index_insert ()
#2  0x00005606e8b9b9c8 in add_next_index_stringl ()
#3  0x00005606e8a33d39 in php_pcre_match_impl ()
#4  0x00005606e8a34642 in ?? ()
#5  0x00007f62ad5e2af0 in xdebug_execute_internal (current_execute_data=0x7f62ae024870, 
    return_value=0x7f62ae024670) at ./build-7.2/xdebug.c:2019
#6  0x00005606e8bda5c8 in ?? ()
#7  0x00005606e8c33123 in execute_ex ()
#8  0x00007f62ad5e1efe in xdebug_execute_ex (execute_data=0x7f62ae0232a0) at ./build-7.2/xdebug.c:1912
#9  0x00005606e8bda6ac in ?? ()
#10 0x00005606e8c33123 in execute_ex ()
#11 0x00007f62ad5e1efe in xdebug_execute_ex (execute_data=0x7f62ae022e90) at ./build-7.2/xdebug.c:1912
#12 0x00005606e8bda254 in ?? ()
#13 0x00005606e8c33123 in execute_ex ()
#14 0x00007f62ad5e1efe in xdebug_execute_ex (execute_data=0x7f62ae022bd0) at ./build-7.2/xdebug.c:1912
#15 0x00005606e8b881b3 in zend_call_function ()
#16 0x00005606e8a85859 in ?? ()
#17 0x00007f62ad5e2af0 in xdebug_execute_internal (current_execute_data=0x7f62ae022b70, 
    return_value=0x7ffe12940160) at ./build-7.2/xdebug.c:2019
#18 0x00005606e8b882e0 in zend_call_function ()
#19 0x00005606e8b88660 in zend_lookup_class_ex ()
#20 0x00005606e8b88fc8 in zend_fetch_class_by_name ()
#21 0x00005606e8c2c64f in ?? ()
#22 0x00005606e8c33123 in execute_ex ()
#23 0x00007f62ad5e1efe in xdebug_execute_ex (execute_data=0x7f62ae022840) at ./build-7.2/xdebug.c:1912
#24 0x00005606e8bda254 in ?? ()
// --- other line identical to the previous one : xdebug_execute_ex (execute_data=0x7f62ae022840) at ./build-7.2/xdebug.c:1912 
#66 0x00005606e8c3af26 in zend_execute ()
#67 0x00005606e8b98173 in zend_execute_scripts ()
#68 0x00005606e8b34588 in php_execute_script ()
#69 0x00005606e8c3d45e in ?? ()
#70 0x00005606e89ed85f in ?? ()
#71 0x00007f62b06ad09b in __libc_start_main (main=0x5606e89ed3d0, argc=3, argv=0x7ffe12945108, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe129450f8) at ../csu/libc-start.c:308
#72 0x00005606e89ed95a in _start ()
 [2019-03-15 16:24 UTC] dunglas at gmail dot com
I can confirm the issue using PHP 7.3.3 on Mac OS (using the PHP binary provided by Homebrew):


PHP 7.3.3 (cli) (built: Mar  8 2019 16:40:07) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.3, Copyright (c) 1999-2018, by Zend Technologies
    with blackfire v1.24.4~mac-x64-non_zts73, https://blackfire.io, by Blackfire
 [2019-03-15 18:20 UTC] pmmaga@php.net
-Status: Open +Status: Duplicate
 [2019-03-15 18:20 UTC] pmmaga@php.net
This has the same root cause as #77535 so I'm marking this one as duplicate.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Dec 08 19:03:36 2021 UTC