tags:

views:

85

answers:

5

Hello

a PHP script stops without an error message, if I change the signature of a method of a class, which implements a intereface, e.g.:

interface A
{
  public function somefunction();
}

class B implements A
{
  public function somefunction(XY $xy);
  {
   ... 
  }
} 

This is an error of course, but there is no error message shown.

What is the name of this error type? (I already searched a lot, but with the wrong phrases obviously) How can I log or output this error?

I'm using PHP 5.3.1 (with XAMPP for Windows 1.7.3)

(I used Zend Debugger with PHP < 5.3 earlier, where those erros were shown in the Eclipse console, but now I'm using XDebug.)

Thanks in advance for any hint!

A: 

Put the following at the top of your script:

error_reporting(E_ALL);

It should report an error.

xil3
+1  A: 

put at the top of file and then try,

<?php
ini_set('display_errors',1);
error_reporting(E_ALL);
?>

If you still getting no output, please check your error_log.

Yogesh
A: 

Thank you for your answers. Sorry, but I should have mentioned, that I have already tried this.

If I switch the reporting level to E_ALL, there a some notices shown, but still no error. (If I "add" a simple syntax error, this is shown.)

Baster
switching to error level E_ALL will only cause a fatal error if the class XY does not exist or the function is called with something other than an object of XY. The error emitted when an function does not adhere to the specification is probably only of type E_STRICT. So change the error level to E_ALL | E_STRICT, or even -1 (future-compatible "every and all error"). Maybe an E_STRICT error is emitted and handled by a custom error handler?
ontrack
outis
A: 

RESOLVED

@ontrack Thanks, your hint directed me to the right direction:

I'm using an autoload function to load required classes (by using spl_autoload_register()). My implemention of my autoloader restrains all error messages... I did not know, that this causes such 'deeper' errors not to show up. This was at least kind of stupid from my side, but I'm more happy, that I found the reason for this problem and I have learned something :-)

Many thanks to all your contributions! And sorry again, that I cannot edit my initial question anymore.

@outis Thanks, please read my comment

Baster
@outis Thank you for this information! This is an important hint for my analysis. I'll try to update to this PHP version (XDebug version is 2.1 already).(It seems, that I cannot edit my initial question, because I added it with a guest account, now I'm answering with a new 'real' account)
Baster
A: 

Something must be up with your configuration. When I try the sample code under PHP 5.3.2+XDebug 2.1.0, PHP complains:

Fatal error: Declaration of B::somefunction() must be compatible with that of A::somefunction()

The type of error is a substitution violation, since a B can't be substituted for an A in all situations.

outis