php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21463 Overload __call method argument lowercase
Submitted: 2003-01-06 09:48 UTC Modified: 2003-01-06 09:56 UTC
From: hfuecks at phppatterns dot com Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.0 OS: Windows NT 4
Private report: No CVE-ID: None
 [2003-01-06 09:48 UTC] hfuecks at phppatterns dot com
Seems the magic __call() function used with the overload extension is converting the name of the function called (the first argument of __call()) to lowercase.

Best summarized with a script;

<?php
class Test {
    function Test () {
        echo ('Test constructed<br />');
    }
    function __call($method,$args) {
        echo ( 'Method called: '.$method.'<br />' );
        switch ( $method ) {
            case 'testa':
                echo ('testa('.$args[0].') success<br />');
                break;
            case 'TestB':
                echo ('TestB('.$args[0].') success<br />');
                break;
            case 'TESTC':
                echo ('TESTC('.$args[0].') success<br />');
                break;
            default:
                echo ('Method unknown<br />');
                break;
        }
    }
}

overload('Test');

$o=new Test();
$o->testa(1);
$o->TestA(2);
$o->TESTA(3);
$o->testb(1);
$o->TestB(2);
$o->TESTB(3);
$o->testc(1);
$o->TestC(2);
$o->TESTC(3);
?>

Output of above script;

Test constructed
Method called: testa
testa(1) success
Method called: testa
testa(2) success
Method called: testa
testa(3) success
Method called: testb
Method unknown
Method called: testb
Method unknown
Method called: testb
Method unknown
Method called: testc
Method unknown
Method called: testc
Method unknown
Method called: testc
Method unknown

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-06 09:56 UTC] gschlossnagle@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

In PHP function/method names are case-insensitive, so they 
all get auto-converted to lowercase.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 22:01:29 2024 UTC