Bug #67881 [Com]: DateTimeZone and DateTime constructors log php warnings when they shouldn't.

From: Date: Wed, 17 Feb 2016 10:11:13 +0000
Subject: Bug #67881 [Com]: DateTimeZone and DateTime constructors log php warnings when they shouldn't.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-199296@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67881&edit=1

 ID:                 67881
 Comment by:         pascal dot sancho at takoma dot fr
 Reported by:        evert at rooftopsolutions dot nl
 Summary:            DateTimeZone and DateTime constructors log php
                     warnings when they shouldn't.
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 Operating System:   Any
 PHP Version:        5.5.15
 Block user comment: N
 Private report:     N

 New Comment:

https://3v4l.org/5bN5o
looking at 3v4l.org eval,
reproduced on any PHP version, including PHP7
while HHVM behaves as expected


Previous Comments:
------------------------------------------------------------------------
[2014-08-22 10:06:59] derick@php.net

It certainly should not be in error_get_last.

------------------------------------------------------------------------
[2014-08-21 18:40:00] requinix@php.net

Just trying to figure out what the bug is about. I know that I didn't expect error_get_last()
to show anything because DateTimeZone is (supposedly) using exceptions instead of errors.
I still can't get it to put anything into the error log though, but I'm sure I just
don't have the right combination of settings or something.

------------------------------------------------------------------------
[2014-08-21 17:58:07] evert at rooftopsolutions dot nl

In a nutshell the main problem is that our users are getting millions of warnings in their error
logs, and there's no way we can suppress it.

------------------------------------------------------------------------
[2014-08-21 17:56:15] evert at rooftopsolutions dot nl

Check the error log. There should be something in there.

Also confirmed as a bug by Derick here: https://github.com/fruux/sabre-vobject/pull/116

------------------------------------------------------------------------
[2014-08-21 17:54:42] requinix@php.net

@ and error suppression don't stop the error from happening but rather how it gets reported to
an error handler (custom or default). error_get_last() will still tell you about the last error
regardless of if/how it was handled.

It sounds like you're saying that code like

  try { new DateTimeZone('Twilight zone'); }
  catch (Exception $e) { /* ignore */ }

generates warnings. I don't see that. Even a custom error handler doesn't get anything -
there's just the exception and what's returned by error_get_last().
http://3v4l.org/RmO4T

So I think you're saying that error_get_last() shouldn't be returning anything? Because
there wasn't an error raised - just the exception.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=67881


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


Thread (8 messages)

« previous php.bugs (#199296) next »