Merge changes from php-gettext 1.0.12
This ensures that parameter to select_string is numeric, avoiding code injection through it. Our code is not vulnerable as we do not pass user supplied values to this function, this fix is included only to be closer to upstream. Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
parent
88cc11ab13
commit
4b5f3f9a12
@ -350,6 +350,10 @@ class gettext_reader {
|
|||||||
* @return int array index of the right plural form
|
* @return int array index of the right plural form
|
||||||
*/
|
*/
|
||||||
function select_string($n) {
|
function select_string($n) {
|
||||||
|
if (!is_int($n)) {
|
||||||
|
throw new InvalidArgumentException(
|
||||||
|
"Select_string only accepts integers: " . $n);
|
||||||
|
}
|
||||||
$string = $this->get_plural_forms();
|
$string = $this->get_plural_forms();
|
||||||
$string = str_replace('nplurals',"\$total",$string);
|
$string = str_replace('nplurals',"\$total",$string);
|
||||||
$string = str_replace("n",$n,$string);
|
$string = str_replace("n",$n,$string);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user