polylang / dynamo

Improves the WordPress translations performance
GNU General Public License v2.0
6 stars 1 forks source link

Fatal error: Uncaught Error: fread(): Argument #2 ($length) must be greater than 0 #23

Closed PhilMakower closed 1 year ago

PhilMakower commented 1 year ago

php v8.2.7 WordPress v6.2.2 WPML v4.6.3 WPML String Translation v3.2.5 Gravity Forms Multilingual v1.7.2 Gravity Forms v2.7.8

Activated GF Multilingual. "completed" translation of the form. Browsed front end page where form shows. Got "Fatal error: Uncaught Error: fread(): Argument #2 ($length) must be greater than 0 at .../src/Dynamic/mo-reader.php line 111"

I added a workaround: if( !$translations[ (int) $headers_idx ]) { return false; } so fread() is not called with an invalid argument #2 I suspect there is something fundamental going on to cause this error though?

Chouby commented 1 year ago

Thanks for the bug report. Could you identify which mo file is causing the fatal error and share it? It will help to reproduce the issue and I'd like to use it in automated tests.

PhilMakower commented 1 year ago

gravity_form-1-de_DE.zip

This file was created by WPML when the client was translating their Gravity Form text

Chouby commented 1 year ago

Thank you :) I tested it and can reproduce the bug. The file doesn't have any translations headers. This is rather unexpected but the format description is not cleat if the headers SHOULD or MUST be present.

I will fix this soon.