0

I am trying to integrate PHP type hinting into a new project. I really like the fact to introduce some type checking for functions. Type hinting works perfectly as long as I am not calling a function with the wrong type. Instead of giving an error message PHP fails silently. The script stops. The page remains white and not even the error logs contain any error entry.

To be more specific, I have the following function:

 private static function parseFilterResult(FilterResult $filterResult) {
 ... DoSomeStuff ...}

If I call the function with a FilterResult object there is no problem. If I call the function with any other object. The silent fail occurs. Did anybody see this behavior before?

Thanks a lot Martin

  • You likely do have an error, but `display_errors` is probably turned off. – datasage Mar 19 '13 at 17:53
  • PHP pretty much never ever fails with no error, you have to be doing something very non-standard to provoke that. What it actually is doing is emitting a `Catchable fatal error` which, while a stupid piece of design on the part of the PHP API, does produce an error message and can be handled (in a needlessly complicated way). Turn error porting to `E_ALL` in development environments and enable the `display_errors` php.ini option. – DaveRandom Mar 19 '13 at 17:58

0 Answers0