PHP Classes

Deprecated Functions

Recommend this page to a friend!

      iCalendar Parser  >  All threads  >  Deprecated Functions  >  (Un) Subscribe thread alerts  
Subject:Deprecated Functions
Summary:Quick advice on replacing deprecated functions
Author:Matt Gibson
Date:2010-10-11 14:18:02
Update:2012-02-06 17:00:25

  1. Deprecated Functions   Reply   Report abuse  
Picture of Matt Gibson Matt Gibson - 2010-10-11 14:18:02
Thanks, works a treat, apart from the small problem on line 291, which, as someone else has already pointed out, should read:

value = str_replace('T', '', $value);

Also, to bring this up to latest PHP compatibility, I replaced split() with preg_split() on line 130:

$this->file_text = preg_split("[\n]", $this->file_text);

...and had to change ereg() for preg_match() and wrap the pattern in slashes on line 266:

preg_match('/([0-9]{4})([0-9]{2})([0-9]{2})([0-9]{0,2})([0-9]{0,2})([0-9]{0,2})/', $ical_date, $date);

One final thing; the code example in comments at the top of the file will never output anything. I replaced


var_dump($ical->get_all_data()); get some output.



  2. Re: Deprecated Functions   Reply   Report abuse  
Picture of bob bob bob bob - 2012-02-06 17:00:25 - In reply to message 1 from Matt Gibson
oen more thing i had to do to make it work:
changed line 274
return mktime($date[4], $date[5], $date[6], $date[2],$date[3], $date[1]);
return mktime(intval($date[4]), intval($date[5]), intval($date[6]), $date[2],$date[3], $date[1]);

this resolved the error
Warning: mktime() expects parameter [n] to be long, string given