New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: Can't Rewrite System Validation Messages #4318
Comments
|
@MGatner Did you already seen something about that? |
I just tried myself and cannot confirm the issue. |
defaultLocale = 'en'; |
This should have been handled in #3254 I think. |
If you can provide faiilng test case case PR, that would be easier to resolve the issue. If you have a way to resolve the issue, please do as well, thank you. You can start from this https://github.com/codeigniter4/CodeIgniter4/blob/fd6feff3838777d50a3c84d87b68bdc2459123bd/CONTRIBUTING.md#how-to-guide |
The test in #4387 fails successfully (besides the image stuff), so overwriting should be working.
|
If I understand correctly, the test case demonstrates that app prioritisation is working as intended? If that's the case, then there are unseen variables causing this issue's problem. |
Correct. |
The message in app/Language/en/Validation.php: The message displayed: I don't know how to use the test system correctly. But analyzing it manually, the rewriting of system validation messages only occurs when I rename the system validation file to any other name. I also noticed that the app/Language/en/Validation.php is called first, but I don't know why it still gets messages from the system file instead of the application file. |
Can close this topic. I can't help but it is a bug. I will change the system files to correct the failure. |
I think I know now where is the problem. |
@ajmeireles Can you do this little tweaking for me in foreach ($this->getNamespaces() as $namespace)
{
if (isset($namespace['path']) && is_file($namespace['path'] . $path))
{
$fullPath = $namespace['path'] . $path;
+ $fullPath = realpath($fullPath) ?: $fullPath;
if ($prioritizeApp)
{
$foundPaths[] = $fullPath;
}
elseif (strpos($fullPath, APPPATH) === 0)
{
$appPaths[] = $fullPath;
}
else
{
$foundPaths[] = $fullPath;
}
}
} |
This snip gives the reason why it's failing. |
Interesting. Why does overriding work in the tests though? |
Simple. Because testing happens outside of Composer world. In our unit tests, the paths do not arise from When required as a vendor by Composer, the paths change. It is now relative to Composer. |
Oh, okay. Never thought about composer 😆 |
@ajmeireles Could you test Paul's suggestion? |
Describe the bug
When I insert custom array of validation messages in the file: app/Language/en/Validation.php the system does not overwrite the system messages with my new messages, this only happens if the file: system/Language/en/Validation.php does not exist or be renamed.
CodeIgniter 4 version
4.1.1
Affected module(s)
Language System - I seen that only work if I remove (or rename) system/Language/en/Validation.php
Expected behavior, and steps to reproduce if appropriate
Inserting a array of Validation Messages in app/Language/en/Validation.php, the system continue to be using the system core Validation messages.
Context
The text was updated successfully, but these errors were encountered: