[BUGFIX] Unit test checkDateWithInvalidDateValues fails with PHP warning
authorSteffen Gebert <steffen.gebert@typo3.org>
Sun, 17 Jul 2011 17:33:59 +0000 (19:33 +0200)
committerHelmut Hummel <typo3@helmut-hummel.de>
Sun, 17 Jul 2011 19:57:13 +0000 (21:57 +0200)
If TYPO3 is configured to not suppress PHP warnings, the unit test
'checkDateWithInvalidDateValues with data set "Not Good"'
of Testsuite tx_scheduler_ModuleTest fails.

As it tries to insert non-numeric values into mkstring(), this warning
is raised.

We can safely suppress the output of PHP warnings for the mktime call,
as afterwards its return value is checked.

Change-Id: I7c6b9f587b574334e0096c800de98cb6ffc2033f
Resolves: #28271
Reviewed-on: http://review.typo3.org/3388
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/scheduler/class.tx_scheduler_module.php

index 635128e..205d74f 100644 (file)
@@ -1452,7 +1452,7 @@ class tx_scheduler_Module extends t3lib_SCbase {
                                list($hour, $minutes) = t3lib_div::trimExplode(':', $time, TRUE);
                                list($day, $month, $year) = t3lib_div::trimExplode('-', $date, TRUE);
                                        // Get a timestamp from all these parts
                                list($hour, $minutes) = t3lib_div::trimExplode(':', $time, TRUE);
                                list($day, $month, $year) = t3lib_div::trimExplode('-', $date, TRUE);
                                        // Get a timestamp from all these parts
-                               $timestamp = mktime($hour, $minutes, 0, $month, $day, $year);
+                               $timestamp = @mktime($hour, $minutes, 0, $month, $day, $year);
                        }
                                // If the timestamp is still FALSE, throw an exception
                        if ($timestamp === FALSE) {
                        }
                                // If the timestamp is still FALSE, throw an exception
                        if ($timestamp === FALSE) {