-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Missing translation in NativeArray should (optionaly) raise a warning #13007
Comments
An exception may be too difficult to deal with, it should be a function: The function may return the key, overriding the code: Example of function to pass: function missingKey($key) {
trigger_error('Can\'t find translation key: '.$key);
return $key; // or better, return nothing with «return '';»
} |
This has been addressed |
niden
added a commit
that referenced
this issue
Jan 10, 2019
* [4.0.x] - PHPCS fix * [4.0.x] - * Revert "[4.0.x] -" This reverts commit a828104. * Revert "Revert "[4.0.x] -"" This reverts commit a438074. * [4.0.x] - Code cleanup * [4.0.x] - Added match to travis for issue branches * [#13007] - Corrected implementation of not found and added test * [#13007] - Corrected errors and exception
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected and Actual Behavior
When using NativeArray (https://github.com/phalcon/cphalcon/blob/master/phalcon/translate/adapter/nativearray.zep) on a missing key, the key itself is returned if there's no translation for this key.
A warning should be raised to deal with such a situation, avoiding displaying keys on the production website. It's not a security issue, but that should help displaying what's intended.
Details
I can create a pull request for this, just tell me if you have a specific implementation to follow: throw an exception (I see that you have
Phalcon\Translate\Exception
), passing a function...And option would be
exceptionOnMissingKey
or anything you'd prefer, defaulting to false of course.The text was updated successfully, but these errors were encountered: