php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49294 ReflectionExtension::info() returns null
Submitted: 2009-08-19 13:45 UTC Modified: 2011-08-30 12:54 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: andreww at uk dot ibm dot com Assigned: johannes (profile)
Status: Closed Package: Reflection related
PHP Version: 5.*, 6 (2009-08-20) OS: *
Private report: No CVE-ID: None
 [2009-08-19 13:45 UTC] andreww at uk dot ibm dot com
Description:
------------
The documentation for the ReflectionExtension class shows info() as returning a string, but it returns NULL and prints the information directly to the screen.

I used the Windows installer package from Jun 29 2009 (basic install, no changes), but was also able to reproduce problem with the 5.3.1-dev snap from Aug 19 2009



Reproduce code:
---------------
<?php
$ext = new ReflectionExtension('iconv');
$info = $ext->info();
printf("Info:\n%s\n", $info ? $info : 'NULL');
?>


Expected result:
----------------
Info: 

iconv support => enabled
iconv implementation => "libiconv"
iconv library version => 1.11

Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1


Actual result:
--------------
iconv

iconv support => enabled
iconv implementation => "libiconv"
iconv library version => 1.11

Directive => Local Value => Master Value
iconv.input_encoding => ISO-8859-1 => ISO-8859-1
iconv.output_encoding => ISO-8859-1 => ISO-8859-1
iconv.internal_encoding => ISO-8859-1 => ISO-8859-1

Info:
NULL

Patches

bug-49294 (last revision 2010-05-28 02:31 UTC by kalle@php.net)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-08-20 09:54 UTC] jani@php.net
There is no such OS as "Any".
 [2009-08-20 10:37 UTC] jani@php.net
Assigned to Johannes who added this method. Seems quite weird that there's one single method that just outputs stuff instead of returning it. Not very consistent.
 [2010-05-28 04:31 UTC] kalle@php.net
The following patch has been added/updated:

Patch Name: bug-49294
Revision:   1275013869
URL:        http://bugs.php.net/patch-display.php?bug=49294&patch=bug-49294&revision=1275013869
 [2010-05-28 04:34 UTC] kalle@php.net
I added a simple patch that alters ReflectionExtension::info() to have a new optional parameter to return the information as an array. If it even makes sense, since the information here can already be retrieved by the getName(), getVersion() and getINIEntries() methods.

Johannes can you please review this and approve or reject it
 [2010-05-28 04:43 UTC] kalle@php.net
Just FYI, my patch only contains the local value, not the master value. But in the end we can always alter the info() method to return a multi dim. array like:

php.ini:
apc.cache_by_default = 0;

Test script:
ini_set('apc.cache_by_default', '1');
$extension = new ReflectionExtension('apc');
$info = $extension->info();

printf('[local=%s] [master=%s]', $info['ini']['apc.cache_by_default']['local'], $info['ini']['apc.cache_by_default']['master']);

Would print:
[local=1] [master=0]
 [2011-08-30 12:54 UTC] bjori@php.net
Automatic comment from SVN on behalf of bjori
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=315777
Log: Fixed bug#49294 (ReflectionExtension::info doesn't return the info)
 [2011-08-30 12:54 UTC] bjori@php.net
-Status: Assigned +Status: Closed
 [2011-08-30 12:54 UTC] bjori@php.net
This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

fixed in the docs.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 09:01:28 2024 UTC