PHP script stops without error message (Which error type?)

不羁的心 提交于 2019-12-25 04:53:51

问题


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!


回答1:


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.




回答2:


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




回答3:


Put the following at the top of your script:

error_reporting(E_ALL);

It should report an error.




回答4:


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.



来源:https://stackoverflow.com/questions/3745466/php-script-stops-without-error-message-which-error-type

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!