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: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: dave at synchtank dot net Assigned:
Status: Open Package: solr (PECL)
PHP Version: 7.0.16 OS: Ubuntu 16 LTS
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.
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

Add a Patch

Pull Requests

Add a Pull Request

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..
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC