Skip to content

Commit c234398

Browse files
committed
xml_parser_free deprecated in PHP8.5
1 parent a874b8c commit c234398

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

getid3/getid3.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class getID3
387387
*/
388388
protected $startup_warning = '';
389389

390-
const VERSION = '1.9.24-202512170412';
390+
const VERSION = '1.9.24-202601031725';
391391
const FREAD_BUFFER_SIZE = 32768;
392392

393393
const ATTACHMENTS_NONE = false;

getid3/module.tag.xmp.php

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,11 @@ public function read_XMP_array_from_text($xmltext)
330330
if (xml_parser_set_option($xml_parser, XML_OPTION_SKIP_WHITE, 0) == false)
331331
{
332332
// Error setting case folding - destroy the parser and return
333-
xml_parser_free($xml_parser);
333+
if (PHP_VERSION_ID < 80000) { // xml_parser_free does nothing after PHP8 and give deprecation warnings in PHP8.5
334+
xml_parser_free($xml_parser);
335+
} else {
336+
unset($xml_parser);
337+
}
334338
return false;
335339
}
336340

@@ -340,20 +344,32 @@ public function read_XMP_array_from_text($xmltext)
340344
if (xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, 0) == false)
341345
{
342346
// Error setting case folding - destroy the parser and return
343-
xml_parser_free($xml_parser);
347+
if (PHP_VERSION_ID < 80000) { // xml_parser_free does nothing after PHP8 and give deprecation warnings in PHP8.5
348+
xml_parser_free($xml_parser);
349+
} else {
350+
unset($xml_parser);
351+
}
344352
return false;
345353
}
346354

347355
// Parse the XML text into a array structure
348356
if (xml_parse_into_struct($xml_parser, $xmltext, $values, $tags) == 0)
349357
{
350358
// Error Parsing XML - destroy the parser and return
351-
xml_parser_free($xml_parser);
359+
if (PHP_VERSION_ID < 80000) { // xml_parser_free does nothing after PHP8 and give deprecation warnings in PHP8.5
360+
xml_parser_free($xml_parser);
361+
} else {
362+
unset($xml_parser);
363+
}
352364
return false;
353365
}
354366

355367
// Destroy the xml parser
356-
xml_parser_free($xml_parser);
368+
if (PHP_VERSION_ID < 80000) { // xml_parser_free does nothing after PHP8 and give deprecation warnings in PHP8.5
369+
xml_parser_free($xml_parser);
370+
} else {
371+
unset($xml_parser);
372+
}
357373

358374
// Clear the output array
359375
$xmp_array = array();

0 commit comments

Comments
 (0)