#32380 [Opn->Csd]: type hinting - error hard to track down

From: Date: Sat, 11 Nov 2006 02:03:56 +0000
Subject: #32380 [Opn->Csd]: type hinting - error hard to track down
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-104807@lists.php.net to get a copy of this message
 ID:               32380
 Updated by:       tony2001@php.net
 Reported By:      freebsd at akruijff dot dds dot nl
-Status:           Open
+Status:           Closed
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD
 PHP Version:      5.0.3
 New Comment:

Error messages have been improved to contain "called in .. declared in
.." long time ago.


Previous Comments:
------------------------------------------------------------------------

[2005-03-20 00:58:35] freebsd at akruijff dot dds dot nl

Description:
------------
Type hinting prevents passing NULL of non related objects as argument.
An error is give on where the function is defined instead of where it
is called. This make it hard to track down the bug, because it could be
called a 100 times from different files, while only one is wrong.


Reproduce code:
---------------
<?php
  class X {
    public function fa() {}
  }

  class Y {
    public function fb() {}
  }

  function f(X $y) {
    $y->fa();
  }

  f(new Y());
?>


Expected result:
----------------
Would like an error on line 14 [   f(new Y()); ]

Actual result:
--------------
Give an erorr on line 11 [ function f(X $y) ].



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32380&edit=1


Thread (1 message)

  • tony2001@php.net
  • Unknown Message
    • tony2001@php.net
« previous php.bugs (#104807) next »