From:             csaba at alum dot mit dot edu
Operating system: Win XP Pro
PHP version:      5.3.0RC1
PHP Bug Type:     COM related
Bug description:  ScriptControl function capitalization discrepancy

Description:
------------
It is possible to call a PHP function in a class that has been stuffed
into a ScriptControl using the code below.  However, the name of the
function must be given as lower case, which is probably not the intent. 
This is especially odd when the original function's name contains capital
letters.

Reproduce code:
---------------
<?php
// Demonstrates that caps in the function name
// leads to an error when calling a function within
// a class within a VBScript ScriptControl
// Related to http://bugs.php.net/bug.php?id=33386

class twoFuncs {
    public function Func1() { echo " func one\n"; }
    public function func2() { echo " func two\n"; } }
$clsInstTF = new twoFuncs;      // class instance

$oScript = new COM("MSScriptControl.ScriptControl");
$oScript->Language = "VBScript";
$oScript->AddObject ("tF", $clsInstTF, true);

$clsInstTF->func1();                        // OK
$clsInstTF->Func1();                        // OK
$oScript->ExecuteStatement ("tF.func1");    // OK
$oScript->ExecuteStatement ("tf.func1");    // OK
$oScript->ExecuteStatement ("tF.Func1");    // Error
?>

Expected result:
----------------
I expect so see " func one" repeated on five consecutive lines

Actual result:
--------------
" func one" is repeated four times, and on the 5th attempt an error
results:
Object doesn't support this property or method: 'tF.Func1'

My guess is that what is happening is that when the function name is being
matched, the actual function name is being lower cased while the function
name being sought is not being lower cased.  Note that class instance in
the VBScript script control is matched regardless of capitalization.

In contrast, if the language line is changed to:
$oScript->Language = "VBScript";
then 4th test line (tf.func1) should be commented out because JScript is
case sensitive there.  But after that commenting out, the last line still
errors.

This bug is similar to, but distinct from, bug 33386

Csaba Gabor from Vienna

-- 
Edit bug report at http://bugs.php.net/?id=47878&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        
http://bugs.php.net/fix.php?id=47878&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        
http://bugs.php.net/fix.php?id=47878&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        
http://bugs.php.net/fix.php?id=47878&r=trysnapshot60
Fixed in CVS:                        
http://bugs.php.net/fix.php?id=47878&r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47878&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=47878&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=47878&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=47878&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=47878&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=47878&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=47878&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=47878&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=47878&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=47878&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47878&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47878&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=47878&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=47878&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=47878&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=47878&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=47878&r=mysqlcfg

Reply via email to