php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74326 Segmentation Fault on OAuth::fetch() using GET
Submitted: 2017-03-28 09:42 UTC Modified: -
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: emir@php.net Assigned:
Status: Open Package: oauth (PECL)
PHP Version: 7.0.17 OS: MacOS 10.12.3
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-03-28 09:42 UTC] emir@php.net
Description:
------------
Oauth::fetch() causes segfault with PHP 7.0.17. Please check the test script below.

The same segfault was reported back in 2009 with PHP 5.2.6. Here is the link to original bug:
https://bugs.php.net/bug.php?id=58871

However this bug is not reproducible in PHP 7.1.3, where it throws the correct  expected exception.

Test script:
---------------
<?php
$oauth = new OAuth('8X5OMIyjnqmGiWmiGPw4Jg','Jy8S6TT1JXtS6mUBlOg0b0I6SOoya7mXfm5ADBGTw',OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->setToken('39469703-nqrXqjB7Vz1CE3dzd9PKqYiCzLozBS5otvsp63g1U','osIx9jLlcouXSZxnX4vo0OvNsNZR07vJDH0VC6Bqg');
$oauth->enableDebug();
$params['cursor'] = -1;
$data = $oauth->fetch("http://twitter.com/followers/ids.json",$params,OAUTH_HTTP_METHOD_GET); // this call causes segmentation fault
$json = json_decode($data);
var_dump($json);

Expected result:
----------------
PHP Fatal error:  Uncaught OAuthException: Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect) in /private/tmp/a.php:6
Stack trace:
#0 /private/tmp/a.php(6): OAuth->fetch('http://twitter....', Array, 'GET')
#1 {main}
  thrown in /private/tmp/a.php on line 6

Fatal error: Uncaught OAuthException: Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect) in /private/tmp/a.php:6
Stack trace:
#0 /private/tmp/a.php(6): OAuth->fetch('http://twitter....', Array, 'GET')
#1 {main}
  thrown in /private/tmp/a.php on line 6

Actual result:
--------------
[1]    40959 segmentation fault  /usr/local/opt/php70/bin/php a.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Mar 31 23:01:23 2020 UTC