CodeIgniter4: Bug: Some translation files are not loaded on purpose

PHP Version

8.3.11

CodeIgniter4 Version

4.5.5

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

fpm-fcgi

What happened?

When trying to use translation files with particular names (like design, services), CodeIgniter does not purposefully load the requested files. Every other name works fine.

I also noticed it doesn’t matter if the filename is only that word: if the filename starts with that word (example: mservices), it still doesn’t load. However, if the filename starts with that word, but ends with a different letter (example: designp), it works. Moreover, if the filename starts with that word, but ends with a letter same as the last letter of the “word” (example: servicess), it doesn’t work.

Steps to Reproduce

Example: app/Language/it/services.php

<?php
return [
    "aaa"  => "bbb",
];
?>

(Copy and paste to app/Language/en/services.php, aka the files are the same inside.)

Try to load services.aaa, you’ll see it doesn’t work:

<?= lang('services.aaa') ?>

Expected Output

Expected output is working translation files without the need for some kind of “filter”.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments