php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74227 Leaving json_last_error() in an error state causes getResponse() to segfault
Submitted: 2017-03-08 23:27 UTC Modified: 2020-06-28 08:17 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: dave at synchtank dot net Assigned: omars (profile)
Status: Assigned Package: solr (PECL)
PHP Version: 7.0.16 OS: Ubuntu 16 LTS
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dave at synchtank dot net
New email:
PHP Version: OS:

 

 [2017-03-08 23:27 UTC] dave at synchtank dot net
Description:
------------
If json_last_error() returns an error state, calling getResponse() causes a segfault.

Clearing json_last_error() by performing a successful json_decode or json_encode prevents the segfault.

I'm on solr 2.4.0 and PHP Version 7.0.15-0ubuntu0.16.04.4, the latest package from Ubuntu 16 LTS.

Test script:
---------------
<?php
json_decode("", true);

// uncommnt below to prevent segfault
// json_decode("[1]");

$client = new SolrClient(array('hostname' => 'myhost', 'port' => 'myport', 'path' => 'mypath', 'wt' => 'json'));

$query = new SolrQuery();

$query->setQuery('*:*');

$response = $client->query($query);

// results in segfault
$results = $response->getResponse();

Expected result:
----------------
segfault


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-10-16 19:33 UTC] jochen dot weber80 at gmail dot com
I can confirm this bug. I just updated from ext version 2.1.0 to 2.4.0 and run into the same issue and the the workaround helps..
 [2019-03-29 09:36 UTC] omars@php.net
-Assigned To: +Assigned To: omars
 [2020-06-28 08:17 UTC] omars@php.net
will try to address in 2.5.1
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 12 14:01:28 2024 UTC