php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71645 PHP7.0.3. OpenSSL Fatal error.
Submitted: 2016-02-22 15:22 UTC Modified: 2016-02-23 03:28 UTC
From: bupy765 at gmail dot com Assigned: yohgaki (profile)
Status: Closed Package: OpenSSL related
PHP Version: 7.0.3 OS: OSX 10.9.5
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bupy765 at gmail dot com
New email:
PHP Version: OS:

 

 [2016-02-22 15:22 UTC] bupy765 at gmail dot com
Description:
------------
I have build PHP7 using following source: ttps://secure.php.net/downloads.php#v7.0.3
I got error associated with OpenSSL when used Composer. Initially I thought that it Composer bug and sent report to Composer team: https://github.com/composer/composer/issues/4940
Together with team of Composer came to the conclusion that it bug PHP7.

Information about PHP7, OpenSSL and OS:

OS X 10.9.5
---
PHP 7.0.3 (cli) (built: Feb 22 2016 19:34:44) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.0RC4, Copyright (c) 2002-2016, by Derick Rethans
---
/Volumes/Home/username/.phpbrew/php/php-7.0.3/var/db/openssl.ini,
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 0.9.8zg 14 July 2015
OpenSSL Header Version => OpenSSL 1.0.1j 15 Oct 2014
Openssl default config => /System/Library/OpenSSL/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
OpenSSL support => enabled


Test script:
---------------
php -ddisplay_errors=1 -derror_reporting=-1 -r 'openssl_x509_parse(file_get_contents("https://raw.githubusercontent.com/composer/composer/master/res/cacert.pem"));'

Expected result:
----------------
PHP Fatal error:  Allowed memory size of 2147483648 bytes exhausted (tried to allocate 9223372036854775912 bytes) in Command line code on line 1
PHP Stack trace:
PHP   1. {main}() Command line code:0
PHP   2. openssl_x509_parse() Command line code:1

Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 9223372036854775912 bytes) in Command line code on line 1

Call Stack:
    0.0001     349360   1. {main}() Command line code:0
    1.8493     610256   2. openssl_x509_parse() Command line code:1


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-22 15:26 UTC] bupy765 at gmail dot com
Sorry! `Expected result` it is `Actual result`.
 [2016-02-22 15:33 UTC] RQuadling at GMail dot com
Interestingly, that value translates to 0x8000 0000 0000 0068. Maybe this is a signed/unsigned issue of some sort?
 [2016-02-22 18:48 UTC] yohgaki@php.net
-Status: Open +Status: Feedback
 [2016-02-22 18:48 UTC] yohgaki@php.net
OpenSSL Library Version => OpenSSL 0.9.8zg 14 July 2015
OpenSSL Header Version => OpenSSL 1.0.1j 15 Oct 2014

You have multiple openssl versions installed in your system and using wrong openssl library.
Link with 1.0.1j and see if it works. (e.g. Remove old openssl)


[yohgaki@dev php-build]$ php -v
PHP 7.0.3 (cli) (built: Feb 23 2016 03:31:55) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.4.0RC4, Copyright (c) 2002-2016, by Derick Rethans

[yohgaki@dev php-build]$ php -ddisplay_errors=1 -derror_reporting=-1 -r 'var_dump(openssl_x509_parse(file_get_contents("https://raw.githubusercontent.com/composer/composer/master/res/cacert.pem")));'
**SNIP worked well**

[yohgaki@dev php-build]$ rpm -q openssl
openssl-1.0.2f-1.fc23.x86_64

OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2f-fips  28 Jan 2016
OpenSSL Header Version => OpenSSL 1.0.2f-fips  28 Jan 2016
Openssl default config => /etc/pki/tls/openssl.cnf
 [2016-02-22 20:32 UTC] bupy765 at gmail dot com
Thanks, yohgaki! I rebuild PHP7 with new OpenSSL:

$ php -i | grep -i openssl
openssl
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 1.0.2f  28 Jan 2016
OpenSSL Header Version => OpenSSL 1.0.2f  28 Jan 2016
Openssl default config => /usr/local/etc/openssl/openssl.cnf
openssl.cafile => no value => no value
openssl.capath => no value => no value
OpenSSL support => enabled

All work! Thanks!
 [2016-02-23 03:28 UTC] yohgaki@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: yohgaki
 [2016-02-23 03:28 UTC] yohgaki@php.net
Reporter confirms it's working now. Thanks for reporting back.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Mar 02 11:01:23 2021 UTC