Page 1 of 1

htmlentities returning nothing in demo

Posted: Sun Oct 05, 2014 4:25 pm
by fluxus
In the demo script demo.basic.php, it was working fine under PHP 5.3, but since I upgraded to PHP 5.5.15 the last statement just gives me a blank page:

echo '<pre>'. htmlentities(print_r($ThisFileInfo, true)). '</pre>';

Unless I change it to this:

echo '<pre>'. htmlentities(print_r($ThisFileInfo, true), ENT_COMPAT, 'iso-8859-1'). '</pre>';

And then it works fine.

getID3 version: 1.9.8-20140511
OS: Win7 x86
Chrome

Re: htmlentities returning nothing in demo

Posted: Sun Oct 05, 2014 5:30 pm
by James Heinrich
The default character set for htmlentities changed from ISO-8859-1 to UTF-8 in PHP v5.4

getID3 by default should output UTF-8, unless you override $getid3->encoding.

I did a quick test with demo.basic.php on PHP v5.4.7 and htmlentities(print_r($ThisFileInfo, true)) and it worked fine.

Does this problem occur for you on only one particular sample file or all files?
Can you show the full code snippet you used to call getID3 and get blank output?

Re: htmlentities returning nothing in demo

Posted: Sun Oct 05, 2014 7:53 pm
by fluxus
I tested another random file and the same thing happens.

Code: Select all

$filename = 'Grind.mp3';
require_once('../getid3.php');
$getID3 = new getID3;
$ThisFileInfo = $getID3->analyze($filename);
getid3_lib::CopyTagsToComments($ThisFileInfo);
echo '<pre>'. htmlentities(print_r($ThisFileInfo, true)).'</pre>';
//echo '<pre>'. htmlentities(print_r($ThisFileInfo, true), ENT_COMPAT, 'iso-8859-1'). '</pre>';