|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-02-07 08:50 UTC] viktor dot machnik at gmail dot com
Description:
------------
Calling a method with 0 parameters, one parameter, 2 parameters makes Problems,
only the first method works, all others give an exception.
Test script:
---------------
<?php
$rnd = new DOTNET("mscorlib", "System.Random");
echo $rnd->Next(); //Work
echo $rnd->Next(10); //Fail
echo $rnd->Next(10, 16); //Fail
/*
- Error:
Fatal error: Uncaught exception 'com_exception' with message 'Error [0x8002000e] Unzulässige Parameteranzahl.
' in [...]test.php:7
Stack trace:
#0 [...]test.php(7): dotnet->Next(10)
#1 {main}
thrown in [...]test.php on line 7
*/
//After this error, script never ends.
?>
Expected result:
----------------
Fatal error: Uncaught exception 'com_exception' with message 'Error [0x8002000e]
Unzulässige Parameteranzahl.
' in [...]test.php:7
Stack trace:
#0 [...]test.php(7): dotnet->Next(10)
#1 {main}
thrown in [...]test.php on line 7
Actual result:
--------------
the methos with the lowest parameter count works
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 07:00:01 2025 UTC |
This behavior is to be expected, because COM does not support overloaded methods directly; instead these get renamed by appending an underscore and a number. In this case you can use: echo $rnd->Next_3(10); echo $rnd->Next_2(10, 16);