From:             jlim at natsoft dot com
Operating system: Windows XP
PHP version:      4.3.2
PHP Bug Type:     Unknown/Other Function
Bug description:  w32api registerfunction fails on 3rd call

Description:
------------
If the 3rd registerfunction (for messageboxa) is commented out, the code
works properly.

Tested with cli version of php.

Reproduce code:
---------------
<?php
error_reporting(E_ALL);

$api = new win32();

$api->registerfunction("long GetTickCount () From Kernel32.dll");
echo "Ticks=",$api->GetTickCount(),"\n";

$api->registerfunction("long GetUserName (string &a, int &b) From
advapi32.dll");
$s1 = "                                        ";
$size = strlen($s1);

$api->GetUsername($s1,$size);
$s1 = substr($s1,0,$size);
echo "u='$s1'\n";

print_r(get_class_methods($api));
$api->registerfunction("int MessageBoxA(long hWnd, string &title, string
&lpCaption, int uType) from User32.dll");
?>

Expected result:
----------------
Ticks=192755858
u='jlim '
Array
(
    [0] => registerfunction
    [1] => unregisterfunction
    [2] => registercallback
    [3] => definetype
    [4] => gettypesize
    [5] => inittype
    [6] => decref
    [7] => gettickcount
    [8] => getusername
)
<br />

Actual result:
--------------
Ticks=192755858
u='jlim '
Array
(
    [0] => registerfunction
    [1] => unregisterfunction
    [2] => registercallback
    [3] => definetype
    [4] => gettypesize
    [5] => inittype
    [6] => decref
    [7] => gettickcount
    [8] => getusername
)
<br />
<b>Fatal error</b>:  Call to undefined function:  registerfunction() in
<b>d:\in
etpub\wwwroot\php\w32.inc.php</b> on line <b>18</b><br />

-- 
Edit bug report at http://bugs.php.net/?id=24453&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=24453&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=24453&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24453&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24453&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24453&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24453&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24453&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24453&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24453&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24453&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24453&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24453&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24453&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24453&r=gnused

Reply via email to