php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24921 calling function with "Class Type Hints" arguments crashes PHP
Submitted: 2003-08-02 14:23 UTC Modified: 2003-08-11 04:54 UTC
From: itotakas at msu dot edu Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2003-08-11 (dev) OS: Win 2000 Pro SP4
Private report: No CVE-ID: None
 [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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-03 05:30 UTC] sniper@php.net
Output with latest CVS:

Warning: Missing argument 1 for get()
 in /usr/src/web/php/php5/t.php on line 4

Fatal error: Argument 1 must be an instance of bug in /usr/src/web/php/php5/t.php on line 4

And no crash here. 
 [2003-08-03 06:20 UTC] itotakas at msu dot edu
I tried php5-win32-200308031030, but still got same result(PHP crush).

I wonder this problem is due to my platform ,,

My platform is
OS : Win 2000 Pro SP4
PHP : php5-win32-200308031030
Apache : 1.3.24
Mode : SAPI modules

Hope this help
 [2003-08-05 18:34 UTC] sniper@php.net
What do you mean with "PHP crush" ??? I guess you mean "crash", but why do you think it crashes?


 [2003-08-05 22:03 UTC] itotakas at msu dot edu
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...
 [2003-08-09 23:15 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

I still can not reproduce this..

 [2003-08-11 04:54 UTC] itotakas at msu dot edu
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 :)
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Aug 15 17:00:02 2025 UTC