php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49941 The function 'extension_loaded' does not compare case-sensitive.
Submitted: 2009-10-21 10:31 UTC Modified: 2009-10-22 15:20 UTC
Votes:3
Avg. Score:3.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:2 (66.7%)
From: michal at roszka dot pl Assigned:
Status: Closed Package: Documentation problem
PHP Version: 5.3.0 OS: Linux 2.6.29.6-smp
Private report: No CVE-ID: None
 [2009-10-21 10:31 UTC] michal at roszka dot pl
Description:
------------
The note says, that the function 'extension_loaded' compares case-

Reproduce code:
---------------
<?php
$e = get_loaded_extensions();
foreach ($e as $k => $v) {
        $l = strtolower($v);
        $u = strtoupper($v);
        $str = "\t* check %s %s: in array %d, extension_loaded %d\n";
        printf("ext: %s\n", $v);
        printf($str, 'original', $v,
                (int) in_array($v, $e), (int) extension_loaded($v)
        );
        printf($str, 'lower-case', $l,
                (int) in_array($l, $e), (int) extension_loaded($l)
        );
        printf($str, 'upper-case', $u,
                (int) in_array($u, $e), (int) extension_loaded($u)
        );
}
exit(0);

Expected result:
----------------
ext: xmlwriter
        * check original xmlwriter: in array 1, extension_loaded 1
        * check lower-case xmlwriter: in array 1, extension_loaded 1
        * check upper-case XMLWRITER: in array 0, extension_loaded 0
ext: PDO
        * check original PDO: in array 1, extension_loaded 1
        * check lower-case pdo: in array 0, extension_loaded 0
        * check upper-case PDO: in array 1, extension_loaded 1
ext: SimpleXML
        * check original SimpleXML: in array 1, extension_loaded 1
        * check lower-case simplexml: in array 0, extension_loaded 0
        * check upper-case SIMPLEXML: in array 0, extension_loaded 0

Actual result:
--------------
ext: xmlwriter
        * check original xmlwriter: in array 1, extension_loaded 1
        * check lower-case xmlwriter: in array 1, extension_loaded 1
        * check upper-case XMLWRITER: in array 0, extension_loaded 1
ext: PDO
        * check original PDO: in array 1, extension_loaded 1
        * check lower-case pdo: in array 0, extension_loaded 1
        * check upper-case PDO: in array 1, extension_loaded 1
ext: SimpleXML
        * check original SimpleXML: in array 1, extension_loaded 1
        * check lower-case simplexml: in array 0, extension_loaded 1
        * check upper-case SIMPLEXML: in array 0, extension_loaded 1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-10-21 10:37 UTC] michal at roszka dot pl
The note says "Be warned that this function compares case sensitive!", which seems not to be true.
 [2009-10-22 15:20 UTC] svn@php.net
Automatic comment from SVN on behalf of rquadling
Revision: http://svn.php.net/viewvc/?view=revision&revision=289852
Log: extension_loaded is case insensitive from PHP5+. Fix bug#49941
 [2009-10-22 15:20 UTC] rquadling@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 10 01:00:02 2026 UTC