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

From: Date: Sun, 20 Mar 2005 01:15:41 +0000
Subject: #32380 [Opn]: type hinting - error hard to track down
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-75548@lists.php.net to get a copy of this message
 ID:               32380
 User updated by:  freebsd at akruijff dot dds dot nl
-Reported By:      freebsd at dds dot nl
+Reported By:      freebsd at akruijff dot dds dot nl
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: FreeBSD
 PHP Version:      5.0.3
 New Comment:

Correcting e-mail


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

[2005-03-20 01:16:57] freebsd at dds dot nl

Changed to feuture request

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

[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)

  • freebsd at akruijff dot dds dot nl
  • Unknown Message
    • freebsd at akruijff dot dds dot nl
« previous php.bugs (#75548) next »