ID:               41461
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ralph at smashlabs dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
-Operating System: Linux
+Operating System: *
-PHP Version:      5.2.2
+PHP Version:      *
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP follows strict is_a inheritance.

By the way, it is called signature and even if you could change it it
would not solve the problem. And anyway it would break inheritance
rules.


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

[2007-05-21 23:06:13] ralph at smashlabs dot com

Description:
------------
When an interface is a parent of a class, the interface is implying a
specific profile for a given function (here its __get) even though it is
not defined in the interface itself.  This is making it impossible to
overload and/or change the profile of the function in a descendant
class.


Reproduce code:
---------------
The following will produce this notice:

Strict Standards: Declaration of Z_Concrete::__get() should be
compatible with that of Z_Abstract::__get() in xxx on line 16

<?php

error_reporting(E_ALL | E_STRICT);

interface Z_Interface
{ }

abstract class Z_Abstract implements Z_Interface
{
  public function __get($name)
  {
    return;
  }
}

class Z_Concrete extends Z_Abstract
{
  public function & __get($name)
  {
    return null;
  }
}

$t = new Z_Concrete();





This code will not produce a notice:

<?php

error_reporting(E_ALL | E_STRICT);

abstract class Z_Abstract
{
  public function __get($name)
  {
    return;
  }
}

class Z_Concrete extends Z_Abstract
{
  public function & __get($name)
  {
    return null;
  }
}

$t = new Z_Concrete();

The only difference is that the former has an interface as a parent,
the latter does not.


Expected result:
----------------
No E_STRICT notice raised

Actual result:
--------------
E_STRICT notice raised.


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


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

Reply via email to