php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47966 array Notice: Undefined index:
Submitted: 2009-04-14 11:23 UTC Modified: 2009-05-03 21:48 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dba at csis dot dk Assigned: pajoye (profile)
Status: Closed Package: cURL related
PHP Version: 6CVS-2009-04-14 (snap) OS: *
Private report: No CVE-ID: None
 [2009-04-14 11:23 UTC] dba at csis dot dk
Description:
------------
can't call array from $curl_getinfo['xxx'] but will output on var_dump() and var_export()
---
phpinfo()
System 	Windows NT DBA-XP-UK 5.1 build 2600 (Windows XP Professional Service Pack 3) i586 
Build Date 	Apr 14 2009 00:27:29 
Compiler 	MSVC6 (Visual C++ 6.0)
Server API 	Apache 2.0 Handler
Apache Version 	Apache/2.2.11 (Win32) PHP/6.0.0-dev


Reproduce code:
---------------
<?php
error_reporting (E_ALL);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.php.net/");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$curl_data = curl_exec($ch);
$curl_getinfo = curl_getinfo($ch);

print "<pre>".var_export($curl_getinfo, true)."</pre>";

print "curl_getinfo['url']: ".$curl_getinfo['url']."<br>"; // Notice: Undefined index: url in D:\home\main\tools\test\index.php on line 19

curl_close($ch);
?>

Expected result:
----------------
output from var_export($curl_getinfo) AND output from print $curl_getinfo['url']

Actual result:
--------------
only gets output from var_export($curl_getinfo)...

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-04-14 11:25 UTC] dba at csis dot dk
correction on commented line 14:
 // Notice: Undefined index: url in D:\home\main\tools\test\index.php on line 14
 [2009-05-03 21:01 UTC] pajoye@php.net
All OSes.

Note that b"url" works, but even using add_assoc_string or add_assoc_utf8_string does not help. See the CAAS macro in interface.c
 [2009-05-03 21:48 UTC] pajoye@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 04:01:28 2024 UTC