JamesHeinrich / getID3

http://www.getid3.org/
Other
1.15k stars 245 forks source link

module.tag.id3v2 crashes PHP 8.2.12 if opcache enabled #425

Closed ShoresOfNowhere closed 3 months ago

ShoresOfNowhere commented 11 months ago

Using latest getid3 1.9.23_202310190849 , when I call getid3 to analyze a file (no matter which file, even if using a file which has non id3 tags such as a simple 1kb svg file) under php 8.2.12 (windows 64bit ts version) with opcache extension enabled, php completely crashes.

I've discovered that disabling id3v2 support (by commenting it out on line 671 of getid3.php) makes all work properly again, and also that the problems happens immediately when the id3v2 support is included (eg it happens even if lines 675->682 of getid3.php are commented out), so it must be something that immediately happens when loading module.tag.id3v2.php, even before the object gets initialized, since the new call is in line 677.

Also, entirely disabling opcache extension makes all work again, even id3v2 support.

That said, I could not find anything easy that might be the culprit, and what most dazzles me is that the only immediate code in module.tag.id3v2.php is the one that preloads id3v1 module, which perfectly works by itself.

JamesHeinrich commented 11 months ago

Interesting. I'm not sure what to say other than "you're right". I'm not familiar with opcache, but turning it on gave the same behavior on my PHP 8.2.4 (win64) test system. I tried tracing through to see why or where it failed, but I was no more successful than you.

If anyone else has some insight or knowledge or experience with opcache I welcome your suggestions.

StudioMaX commented 11 months ago

Tried to check this on Windows with PHP 8.2.12 and opcache enabled and I can't reproduce this issue. Could you provide the opcache config? php.exe --ri "Zend OPcache"

ShoresOfNowhere commented 11 months ago
Opcode Caching Up and Running
Optimization Enabled
SHM Cache Enabled
File Cache Disabled
JIT On
Startup OK
Shared memory model win32
Cache hits 6898
Cache misses 58
Used memory 13478512
Free memory 120739216
Wasted memory 0
Interned Strings Used memory 3265112
Interned Strings Free memory 5123496
Cached scripts 58
Cached keys 117
Max keys 16229
OOM restarts 0
Hash keys restarts 0
Manual restarts 0
opcache.blacklist_filename no value no value
opcache.cache_id no value no value
opcache.consistency_checks 0 0
opcache.dups_fix Off Off
opcache.enable On On
opcache.enable_cli Off Off
opcache.enable_file_override Off Off
opcache.error_log no value no value
opcache.file_cache no value no value
opcache.file_cache_consistency_checks On On
opcache.file_cache_fallback On On
opcache.file_cache_only Off Off
opcache.file_update_protection 2 2
opcache.force_restart_timeout 180 180
opcache.interned_strings_buffer 8 8
opcache.jit tracing tracing
opcache.jit_bisect_limit 0 0
opcache.jit_blacklist_root_trace 16 16
opcache.jit_blacklist_side_trace 8 8
opcache.jit_buffer_size 0 0
opcache.jit_debug 0 0
opcache.jit_hot_func 127 127
opcache.jit_hot_loop 64 64
opcache.jit_hot_return 8 8
opcache.jit_hot_side_exit 8 8
opcache.jit_max_exit_counters 8192 8192
opcache.jit_max_loop_unrolls 8 8
opcache.jit_max_polymorphic_calls 2 2
opcache.jit_max_recursive_calls 2 2
opcache.jit_max_recursive_returns 2 2
opcache.jit_max_root_traces 1024 1024
opcache.jit_max_side_traces 128 128
opcache.jit_prof_threshold 0.005 0.005
opcache.log_verbosity_level 1 1
opcache.max_accelerated_files 10000 10000
opcache.max_file_size 0 0
opcache.max_wasted_percentage 5 5
opcache.memory_consumption 128 128
opcache.mmap_base no value no value
opcache.opt_debug_level 0 0
opcache.optimization_level 0x7FFEBFFF 0x7FFEBFFF
opcache.preferred_memory_model no value no value
opcache.preload no value no value
opcache.protect_memory Off Off
opcache.record_warnings Off Off
opcache.restrict_api no value no value
opcache.revalidate_freq 2 2
opcache.revalidate_path Off Off
opcache.save_comments On On
opcache.use_cwd On On
opcache.validate_permission Off Off
opcache.validate_timestamps On On
StudioMaX commented 11 months ago

Thanks, I tried to apply your config in combination with Apache (mod_php), FastCGI, the built-in PHP web server and in CLI mode, but still was unable to reproduce this. Do you have any older versions of PHP? 7.x or 8.x, to see if this issue will occur again with opcache enabled.

ShoresOfNowhere commented 11 months ago

I don't have older version on this pc, but I'm sure this did not happen in 8.1.x, even with opcache on.

M-Shahbaz commented 10 months ago

I'm having the same issue, disabling

;zend_extension=opcache
is working. Please note that apparently PHP Cli seems to be working fine but through localhost web apache its crashing.

StudioMaX commented 10 months ago

@M-Shahbaz Do you also use Windows? Do you use some kind of bundle like WAMP, or install PHP yourself? Maybe this has something to do with the latest minor versions of PHP, because this was not reported before November.

M-Shahbaz commented 10 months ago

@StudioMaX I installed XAMPP https://www.apachefriends.org/ on windows 10

ShoresOfNowhere commented 10 months ago

I'm not using XAMPP, I have manually installed Apache 2.4.54 64 bit and PHP 8.2.12 (windows 64bit ts version).

ShoresOfNowhere commented 3 months ago

Sorry to bring this up, I think we can close this bug as, if I remember correctly, this was a bug in opcache extension that getid3 was triggering, and not a real bug in getid3, am I right?