1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118
|
--TEST--
#44938: gettext functions crash with overlong strings
--EXTENSIONS--
gettext
--FILE--
<?php
$overflown = str_repeat('C', 8476509);
$msgid = "msgid";
$domain = "domain";
$category = "cat";
try {
bindtextdomain($overflown, 'path');
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dngettext($overflown, $msgid, $msgid, 1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dngettext($domain, $overflown, $msgid, 1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dngettext($domain, $msgid, $overflown, 1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
gettext($overflown);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
ngettext($overflown, $msgid, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
ngettext($msgid, $overflown, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dcgettext($overflown, $msgid, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dcgettext($domain, $overflown, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dcngettext($overflown, $msgid, $msgid, -1, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dcngettext($domain, $overflown, $msgid, -1, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dcngettext($domain, $msgid, $overflown, -1, -1);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dgettext($overflown, $msgid);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
dgettext($domain, $overflown);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
try {
textdomain($overflown);
} catch (ValueError $exception) {
echo $exception->getMessage() . "\n";
}
?>
--EXPECT--
bindtextdomain(): Argument #1 ($domain) is too long
dngettext(): Argument #1 ($domain) is too long
dngettext(): Argument #2 ($singular) is too long
dngettext(): Argument #3 ($plural) is too long
gettext(): Argument #1 ($message) is too long
ngettext(): Argument #1 ($singular) is too long
ngettext(): Argument #2 ($plural) is too long
dcgettext(): Argument #1 ($domain) is too long
dcgettext(): Argument #2 ($message) is too long
dcngettext(): Argument #1 ($domain) is too long
dcngettext(): Argument #2 ($singular) is too long
dcngettext(): Argument #3 ($plural) is too long
dgettext(): Argument #1 ($domain) is too long
dgettext(): Argument #2 ($message) is too long
textdomain(): Argument #1 ($domain) is too long
|