phpscript bug

Posted by Dntc2008 on Sun 18 Dec 2005 07:22 AM — 2 posts, 10,134 views.

#0
I get an error When I use this Script:

<aliases>
<alias
enabled="y"
match="eat (.+)"
regexp="y"
script="test"
sequence="100"
>
</alias>
</aliases>

<script>
<![CDATA[
function test($name, $line, $wildcards)
{
$world->Note($wildcards[0]);
}
]]>
</script>

error description:
Uncaught exception 'com_exception' with message 'index out of bounds' in fragment:3
Stack trace:
#0 fragment(3): variant->test()
#1 [internal function]: test(Object(variant), Object(variant), Object(variant))
#2 {main}
thrown

And I find the type of $name, $line, $wildcards all is object
BUG?
Australia Forum Administrator #1
The first wildcard is 1, that is why it is out of bounds.

Use this:


function test($name, $line, $wildcards)
{
$world->Note($wildcards[1]);
}