u01jmg3 / ics-parser

Parser for iCalendar Events • PHP 8+, 7 (≥ 7.4), 5 (≥ 5.6)
MIT License
450 stars 144 forks source link

PHP 7.2 Warning - mb_split(): Pattern is not valid under UTF-8 encoding #230

Closed garciagaston closed 5 years ago

garciagaston commented 5 years ago

Description of the Issue:

After switching to PHP 7.2, new \ICal\ICal($filename) causes PHP to throw the following

WARNING: mb_split(): Pattern is not valid under UTF-8 encoding #0 [internal function]
/vendor/johngrogg/ics-parser/src/ICal/ICal.php(2222)

Steps to Reproduce:

testCalendar.zip

u01jmg3 commented 5 years ago

Using the ICS provided on PHP 7.2.14 it works fine for me.

PHP 7 2 14

garciagaston commented 5 years ago

It's works well but throwing a lot of warning exceptions in the log file. mb_split(): Pattern is not valid under UTF-8 encoding

u01jmg3 commented 5 years ago

throwing a lot of warning exceptions in the log file

Which log file? In my PHP error log I see nothing.


Please provide me with the exact ICS file causing you the issue.

I cannot reproduce the issue you are seeing with the file you have already provided me.

garciagaston commented 5 years ago

I attached the ICS file and the warning logs on PHP 7.2.20

WEB.WARNING: mb_split(): Pattern is not valid under UTF-8 encoding #0 [internal function]: Logs\Handler\Error::handler(2, 'mb_split(): Pat...', 2222, Array) #1 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(2222): mb_split('\x85', 'BEGIN:VCALENDAR') #2 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(2266): ICal\ICal->mb_str_replace('\x85', Array, 'BEGIN:VCALENDAR') #3 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(329): ICal\ICal->cleanData('BEGIN:VCALENDAR') #4 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(255): ICal\ICal->initLines(Array)

WEB.WARNING: count(): Parameter must be an array or an object that implements Countable #0 [internal function]: Logs\Handler\Error::handler(2, 'count(): Parame...', 2223, Array) #1 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(2223): count(false) #2 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(2266): ICal\ICal->mb_str_replace('\x85', Array, 'BEGIN:VCALENDAR') #3 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(329): ICal\ICal->cleanData('BEGIN:VCALENDAR') #4 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(255): ICal\ICal->initLines(Array) 

WEB.WARNING: implode(): Invalid arguments passed #0 [internal function]: Logs\Handler\Error::handler(2, 'implode(): Inva...', 2224, Array) #1 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(2224): implode(''', false) #2 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(2266): ICal\ICal->mb_str_replace('\x85', Array, 'BEGIN:VCALENDAR') #3 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(329): ICal\ICal->cleanData('BEGIN:VCALENDAR') #4 /vendor/johngrogg/ics-parser/src/ICal/ICal.php(255): ICal\ICal->initLines(Array)
s0600204 commented 5 years ago

(The line numbers in the warnings appear to line up with the parser code as it was at v.2.1.5.)

I, too, cannot get the warnings to appear with PHP 7.2.x

u01jmg3 commented 5 years ago

Closing due to inactivity. Please remember to try the latest version of the parser before raising an issue as the problem may already have been fixed.