summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2004-11-29 10:15:04 +0000
committerSVN Migration <svn@php.net>2004-11-29 10:15:04 +0000
commit78388bd7c5a1686cec5ae17db21f5dee8f04b8da (patch)
treefe1992f61d1e73694ee7228ebc62ba80f4097398
parent5742bd2c5209df5e2e5c5a2511fa0cf54140d8d8 (diff)
downloadphp-git-78388bd7c5a1686cec5ae17db21f5dee8f04b8da.tar.gz
This commit was manufactured by cvs2svn to create branch 'PHP_4_3'.
-rw-r--r--ext/standard/tests/math/bug30695.phpt54
1 files changed, 54 insertions, 0 deletions
diff --git a/ext/standard/tests/math/bug30695.phpt b/ext/standard/tests/math/bug30695.phpt
new file mode 100644
index 0000000000..c515784ee2
--- /dev/null
+++ b/ext/standard/tests/math/bug30695.phpt
@@ -0,0 +1,54 @@
+--TEST--
+Bug #30695 (32 bit issues)
+--FILE--
+<?php
+ function toUTF8( $char_code )
+ {
+ switch ( $char_code )
+ {
+ case 0:
+ $char = chr( 0 );
+ case !($char_code & 0xffffff80): // 7 bit
+ $char = chr( $char_code );
+ break;
+ case !($char_code & 0xfffff800): // 11 bit
+ $char = ( chr(0xc0 | (($char_code >> 6) & 0x1f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xffff0000): // 16 bit
+ $char = ( chr(0xe0 | (($char_code >> 12) & 0x0f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xffe00000): // 21 bit
+ $char = ( chr(0xf0 | (($char_code >> 18) & 0x07)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ break;
+ case !($char_code & 0xfc000000): // 26 bit
+ $char = ( chr(0xf8 | (($char_code >> 24) & 0x03)) .
+ chr(0x80 | (($char_code >> 18) & 0x3f)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ default: // 31 bit
+ $char = ( chr(0xfc | (($char_code >> 30) & 0x01)) .
+ chr(0x80 | (($char_code >> 24) & 0x3f)) .
+ chr(0x80 | (($char_code >> 18) & 0x3f)) .
+ chr(0x80 | (($char_code >> 12) & 0x3f)) .
+ chr(0x80 | (($char_code >> 6) & 0x3f)) .
+ chr(0x80 | ($char_code & 0x3f)) );
+ }
+ return $char;
+ }
+
+
+ echo "\n", toUTF8(65), "\n", toUTF8(233), "\n", toUTF8(1252), "\n", toUTF8(20095), "\n";
+?>
+--EXPECT--
+
+A
+乿