php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78493 Null Character in getLastResponseInfo output
Submitted: 2019-09-04 17:51 UTC Modified: 2019-09-05 10:50 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: adam at adam dot gs Assigned: cmb (profile)
Status: Duplicate Package: oauth (PECL)
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: adam at adam dot gs
New email:
PHP Version: OS:

 

 [2019-09-04 17:51 UTC] adam at adam dot gs
Description:
------------
Hi,
Running a simple oauth request results in all keys returned by getLastResponseInfo being suffixed with a null byte.

seems like this was reported here (incorrectly), but, never looked at.

https://github.com/dropbox-php/dropbox-php/issues/31

This is very fun to debug as print_r/var_dump and even serialize don't display/encode the non-printable characters.

# php --re oauth|head
Extension [ <persistent> extension #32 OAuth version 2.0.2 ] {

I don't have the latest version of the OAuth extension but the only changes from 2.0.2 to 2.0.3 appear to be irrelevant.

Test script:
---------------
<?php
$oauth = new OAuth('a', 'b',OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_AUTHORIZATION);
$oauth->fetch("https://www.google.com/",array(),OAUTH_HTTP_METHOD_GET,array("Accept"=>"text/xml"));
$response_info = $oauth->getLastResponseInfo();
print_r($response_info);
var_dump($response_info);
printf("%s\n",json_encode($response_info,JSON_PRETTY_PRINT));

Actual result:
--------------
php test2.php 
Array
(
    [url] => https://www.google.com/
    [http_code] => 200
    [content_type] => text/html; charset=ISO-8859-1
    [size_download] => 47244
    [size_upload] => 0
)
array(5) {
  ["url"]=>
  string(23) "https://www.google.com/"
  ["http_code"]=>
  int(200)
  ["content_type"]=>
  string(29) "text/html; charset=ISO-8859-1"
  ["size_download"]=>
  float(47244)
  ["size_upload"]=>
  float(0)
}
{
    "url\u0000": "https:\/\/www.google.com\/",
    "http_code\u0000": 200,
    "content_type\u0000": "text\/html; charset=ISO-8859-1",
    "size_download\u0000": 47244,
    "size_upload\u0000": 0
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-09-05 10:50 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2019-09-05 10:50 UTC] cmb@php.net
Duplicate of bug #73434.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC