php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #24453 w32api registerfunction fails on 3rd call
Submitted: 2003-07-02 01:11 UTC Modified: 2011-01-01 01:49 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:2 (40.0%)
From: jlim at natsoft dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.3.3-RC2dev OS: Windows XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jlim at natsoft dot com
New email:
PHP Version: OS:

 

 [2003-07-02 01:11 UTC] jlim at natsoft dot com
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 />

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-07-02 15:04 UTC] stone@php.net
Works here as expected with 4.3.2 CLI and CGI on XP Pro.

 [2011-01-01 01:48 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2011-01-01 01:49 UTC] jani@php.net
This ext is in PECL nowadays.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 17:01:29 2024 UTC