|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2003-08-02 14:23 UTC] itotakas at msu dot edu
Description:
------------
calling function with "Class Type Hints" arguments cause PHP crush
Reproduce code:
---------------
<?
class bug {
function get(bug $bug)
{
return $bug;
}
}
$bug = new bug;
// PHP should report the missing argument here
$bug->get();
?>
Expected result:
----------------
showing error "missing argument"
Actual result:
--------------
PHP crush
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 07 14:00:01 2025 UTC |
At first, I should say sorry for easy type miss :( I meant "PHP crash". I tried other codes to find out the pattern of this problem. <? class bug { function get(bug $bug) { return $bug; } } class test { function call() { $bug = new bug; // PHP should report the missing argument here $bug->get(); } } $test = new test; $test->call(); ?> This code also cause PHP crash like the reproduce code I posted before. ============================================= Apache.exe - Application Error Command "0x100f334" tried to refer Memory "0x0000000c". Memory could not be "read" Nonhandled Exception occurred in Apache(PHP4TS.dll) 0xC0000005: Access Violation ============================================= but, I am not sure why this problem happen... I hope other users can reproduce same problem so that more infomation will be available for this problem...I tried php5-win32-200308110630 with the reproduce code below --------------------- <? class bug { function get(bug $bug) { return $bug; } } $bug = new bug; // PHP should report the missing argument here $bug->get(); ?> but NO "PHP Crash" was occured. the output was "Fatal error: Argument 1 must be an object of class bug" so I think this problem was solved. php5-win32-200308030630 >> Crash php5-win32-200308031030 >> Crash php5-win32-200308041030 >> NO Crash php5-win32-200308050230 >> NO Crash php5-win32-200308070230 >> NO Crash php5-win32-200308110630 >> NO Crash I am not sure what was the causation of this problem yet,, but Thank you any way for the Feedback sniper :)