PHP 5.3 web core patch

Dmitry Morozovsky marck at rinet.ru
Sun May 16 11:12:49 EDT 2010


Dear colleagues,

ereg() is deprecated, and its usage emits a warning. Quick fix:

--- /usr/local/tb/scripts/webui/core/functions.php~     2010-02-07 16:06:53.522611743 +0300
+++ /usr/local/tb/scripts/webui/core/functions.php      2010-05-16 19:10:33.970712234 +0400
@@ -28,10 +28,10 @@
 #
 
 function prettyDatetime($input) {
-       if (ereg("[0-9]{14}", $input)) {
+       if (preg_match("/^[0-9]{14}/", $input)) {
                /* timstamp */
                return substr($input,0,4)."-".substr($input,4,2)."-".substr($input,6,2)." ".substr($input,8,2).":".substr($input,10,2).":".substr($input,12,2);
-       } elseif (ereg("[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}", $input)) {
+       } elseif (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}/", $input)) {
                /* datetime */
                if ($input == "0000-00-00 00:00:00" ||
                    $input == "0000-00-00 00:00:00.000000") {



-- 
Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
[ FreeBSD committer:                                 marck at FreeBSD.org ]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------


More information about the tinderbox-list mailing list