!C99Shell v.2.1 [PHP 7 Update] [1.12.2019]!

Software: Apache. PHP/5.3.29 

uname -a: Linux tardis23.nocplanet.net 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024
x86_64
 

 

Safe-mode: OFF (not secure)

/opt/alt/php55/usr/share/pear/test/Net_IDNA2/tests/   drwxr-xr-x
Free 978.94 GB of 1859.98 GB (52.63%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     draft-josefsson-idn-test-vectors.php (17.27 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
require_once 'Net/IDNA2.php';

// Test cases from https://www.gnu.org/software/libidn/draft-josefsson-idn-test-vectors.html

define('IDNA_ACE_PREFIX''xn--');

class 
IDNATest extends PHPUnit_Framework_TestCase {

    public function 
setUp() {
        
$this->idn = new Net_IDNA2();
    }

    static function 
unichr($chr) {
        return 
mb_convert_encoding('&#' intval($chr) . ';''UTF-8''HTML-ENTITIES');
    }

    private function 
hexarray2string($arr) {
        return 
implode(''array_map(array('self''unichr'), $arr));
    }

    public function 
testDecode1() {
        
// Arabic (Egyptian)
        
$expected $this->hexarray2string(array(
            
0x06440x064A0x06470x06450x06270x06280x062A0x0643,
            
0x06440x06450x06480x06340x06390x06310x06280x064A,
            
0x061F
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."egbpdaj6bu4bxfgehfvwxn");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode2() {
        
// Chinese (simplified)
        
$expected $this->hexarray2string(array(
            
0x4ED60x4EEC0x4E3A0x4EC00x4E480x4E0D0x8BF40x4E2D0x6587
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."ihqwcrb4cv8a8dqg056pqjye");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode3() {
        
// Chinese (traditional)
        
$expected $this->hexarray2string(array(
            
0x4ED60x50110x72320x4EC00x9EBD0x4E0D0x8AAA0x4E2D0x6587
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."ihqwctvzc91f659drss3x8bo0yb");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode4() {
        
// Czech
        
$expected $this->hexarray2string(array(
            
0x00500x00720x006F0x010D0x00700x00720x006F0x0073,
            
0x00740x011B0x006E0x00650x006D0x006C0x00750x0076,
            
0x00ED0x010D0x00650x00730x006B0x0079
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."Proprostnemluvesky-uyb24dma41a");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode5() {
        
// Hebrew
        
$expected $this->hexarray2string(array(
            
0x05DC0x05DE0x05D40x05D40x05DD0x05E40x05E90x05D5,
            
0x05D80x05DC0x05D00x05DE0x05D30x05D10x05E80x05D9,
            
0x05DD0x05E20x05D10x05E80x05D90x05EA
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."4dbcagdahymbxekheh6e0a7fei0b");
        
$this->assertSame($expected$result);
    }

      public function 
testDecode6() {
        
// Hindi (Devanagari)
        
$expected $this->hexarray2string(array(
            
0x092F0x09390x09320x094B0x09170x09390x093F0x0928,
            
0x094D0x09260x09400x09150x094D0x092F0x094B0x0902,
            
0x09280x09390x09400x09020x092C0x094B0x09320x0938,
            
0x09150x09240x09470x09390x09480x0902
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode7() {
        
// Japanese (kanji and hiragana)
        
$expected $this->hexarray2string(array(
            
0x306A0x305C0x307F0x30930x306A0x65E50x672C0x8A9E,
            
0x30920x8A710x30570x30660x304F0x308C0x306A0x3044,
            
0x306E0x304B
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode8() {
        
// Russian (Cyrillic)
        
$expected $this->hexarray2string(array(
            
0x043F0x043E0x04470x04350x043C0x04430x04360x0435,
            
0x043E0x043D0x04380x043D0x04350x04330x043E0x0432,
            
0x043E0x04400x044F0x04420x043F0x043E0x04400x0443,
            
0x04410x04410x043A0x0438
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."b1abfaaepdrnnbgefbadotcwatmq2g4l");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode9() {
        
// Spanish
        
$expected $this->hexarray2string(array(
            
0x00500x006F0x00720x00710x00750x00E90x006E0x006F,
            
0x00700x00750x00650x00640x00650x006E0x00730x0069,
            
0x006D0x00700x006C0x00650x006D0x00650x006E0x0074,
            
0x00650x00680x00610x00620x006C0x00610x00720x0065,
            
0x006E0x00450x00730x00700x00610x00F10x006F0x006C
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."PorqunopuedensimplementehablarenEspaol-fmd56a");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode10() {
        
// Vietnamese
        
$expected $this->hexarray2string(array(
            
0x00540x1EA10x00690x00730x00610x006F0x00680x1ECD,
            
0x006B0x00680x00F40x006E0x00670x00740x00680x1EC3,
            
0x00630x00680x1EC90x006E0x00F30x00690x00740x0069,
            
0x1EBF0x006E0x00670x00560x00690x1EC70x0074
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode11() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x00330x5E740x00420x7D440x91D10x516B0x51480x751F
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."3B-ww4c5e180e575a65lsy2b");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode12() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x5B890x5BA40x59480x7F8E0x60750x002D0x00770x0069,
            
0x00740x00680x002D0x00530x00550x00500x00450x0052,
            
0x002D0x004D0x004F0x004E0x004B0x00450x00590x0053
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode13() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x00480x00650x006C0x006C0x006F0x002D0x00410x006E,
            
0x006F0x00740x00680x00650x00720x002D0x00570x0061,
            
0x00790x002D0x305D0x308C0x305E0x308C0x306E0x5834,
            
0x6240
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."Hello-Another-Way--fc4qua05auwb3674vfr0b");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode14() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x30720x30680x30640x5C4B0x68390x306E0x4E0B0x0032
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."2-u9tlzr9756bt3uc0v");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode15() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x004D0x00610x006A0x00690x30670x004B0x006F0x0069,
            
0x30590x308B0x00350x79D20x524D
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."MajiKoi5-783gue6qz075azm5e");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode16() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x30D10x30D50x30A30x30FC0x00640x00650x30EB0x30F30x30D0
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."de-jg4avhby1noc0d");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode17() {
        
// Japanese
        
$expected $this->hexarray2string(array(
            
0x305D0x306E0x30B90x30D40x30FC0x30C90x3067
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."d9juau41awczczp");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode18() {
        
// Greek
        
$expected $this->hexarray2string(array(
            
0x03b50x03bb0x03bb0x03b70x03bd0x03b90x03ba0x03ac
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."hxargifdar");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode19() {
        
// Maltese (Malti)
        
$expected $this->hexarray2string(array(
            
0x00620x006f0x006e0x01210x00750x00730x00610x0127,
            
0x01270x0061
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."bonusaa-5bb1da");
        
$this->assertSame($expected$result);
    }

    public function 
testDecode20() {
        
// Russian (Cyrillic)
        
$expected $this->hexarray2string(array(
            
0x043f0x043e0x04470x04350x043c0x04430x04360x0435,
            
0x043e0x043d0x04380x043d0x04350x04330x043e0x0432,
            
0x043e0x04400x044f0x04420x043f0x043e0x04400x0443,
            
0x04410x04410x043a0x0438
        
));
        
$result $this->idn->decode(IDNA_ACE_PREFIX."b1abfaaepdrnnbgefbadotcwatmq2g4l");
        
$this->assertSame($expected$result);
    }

    public function 
testEncode1() {
        
// Arabic (Egyptian)
        
$idna $this->hexarray2string(array(
            
0x06440x064A0x06470x06450x06270x06280x062A0x0643,
            
0x06440x06450x06480x06340x06390x06310x06280x064A,
            
0x061F
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."egbpdaj6bu4bxfgehfvwxn"$result);
    }

    public function 
testEncode2() {
        
// Chinese (simplified)
        
$idna $this->hexarray2string(array(
            
0x4ED60x4EEC0x4E3A0x4EC00x4E480x4E0D0x8BF40x4E2D0x6587
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."ihqwcrb4cv8a8dqg056pqjye"$result);
    }

    public function 
testEncode3() {
        
// Chinese (traditional)
        
$idna $this->hexarray2string(array(
            
0x4ED60x50110x72320x4EC00x9EBD0x4E0D0x8AAA0x4E2D0x6587
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."ihqwctvzc91f659drss3x8bo0yb"$result);
    }

    public function 
testEncode4() {
        
// Czech
        
$idna $this->hexarray2string(array(
            
0x00500x00720x006F0x010D0x00700x00720x006F0x0073,
            
0x00740x011B0x006E0x00650x006D0x006C0x00750x0076,
            
0x00ED0x010D0x00650x00730x006B0x0079
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."proprostnemluvesky-uyb24dma41a"$result);
    }

    public function 
testEncode5() {
        
// Hebrew
        
$idna $this->hexarray2string(array(
            
0x05DC0x05DE0x05D40x05D40x05DD0x05E40x05E90x05D5,
            
0x05D80x05DC0x05D00x05DE0x05D30x05D10x05E80x05D9,
            
0x05DD0x05E20x05D10x05E80x05D90x05EA
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."4dbcagdahymbxekheh6e0a7fei0b"$result);
    }

      public function 
testEncode6() {
        
// Hindi (Devanagari)
        
$idna $this->hexarray2string(array(
            
0x092F0x09390x09320x094B0x09170x09390x093F0x0928,
            
0x094D0x09260x09400x09150x094D0x092F0x094B0x0902,
            
0x09280x09390x09400x09020x092C0x094B0x09320x0938,
            
0x09150x09240x09470x09390x09480x0902
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd"$result);
    }

    public function 
testEncode7() {
        
// Japanese (kanji and hiragana)
        
$idna $this->hexarray2string(array(
            
0x306A0x305C0x307F0x30930x306A0x65E50x672C0x8A9E,
            
0x30920x8A710x30570x30660x304F0x308C0x306A0x3044,
            
0x306E0x304B
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa"$result);
    }

    public function 
testEncode8() {
        
// Russian (Cyrillic)
        
$idna $this->hexarray2string(array(
            
0x043F0x043E0x04470x04350x043C0x04430x04360x0435,
            
0x043E0x043D0x04380x043D0x04350x04330x043E0x0432,
            
0x043E0x04400x044F0x04420x043F0x043E0x04400x0443,
            
0x04410x04410x043A0x0438
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."b1abfaaepdrnnbgefbadotcwatmq2g4l"$result);
    }

    public function 
testEncode9() {
        
// Spanish
        
$idna $this->hexarray2string(array(
            
0x00500x006F0x00720x00710x00750x00E90x006E0x006F,
            
0x00700x00750x00650x00640x00650x006E0x00730x0069,
            
0x006D0x00700x006C0x00650x006D0x00650x006E0x0074,
            
0x00650x00680x00610x00620x006C0x00610x00720x0065,
            
0x006E0x00450x00730x00700x00610x00F10x006F0x006C
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."porqunopuedensimplementehablarenespaol-fmd56a"$result);
    }

    public function 
testEncode10() {
        
// Vietnamese
        
$idna $this->hexarray2string(array(
            
0x00540x1EA10x00690x00730x00610x006F0x00680x1ECD,
            
0x006B0x00680x00F40x006E0x00670x00740x00680x1EC3,
            
0x00630x00680x1EC90x006E0x00F30x00690x00740x0069,
            
0x1EBF0x006E0x00670x00560x00690x1EC70x0074
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."tisaohkhngthchnitingvit-kjcr8268qyxafd2f1b9g"$result);
    }

    public function 
testEncode11() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x00330x5E740x00420x7D440x91D10x516B0x51480x751F
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."3b-ww4c5e180e575a65lsy2b"$result);
    }

    public function 
testEncode12() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x5B890x5BA40x59480x7F8E0x60750x002D0x00770x0069,
            
0x00740x00680x002D0x00530x00550x00500x00450x0052,
            
0x002D0x004D0x004F0x004E0x004B0x00450x00590x0053
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."-with-super-monkeys-pc58ag80a8qai00g7n9n"$result);
    }

    public function 
testEncode13() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x00480x00650x006C0x006C0x006F0x002D0x00410x006E,
            
0x006F0x00740x00680x00650x00720x002D0x00570x0061,
            
0x00790x002D0x305D0x308C0x305E0x308C0x306E0x5834,
            
0x6240
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."hello-another-way--fc4qua05auwb3674vfr0b"$result);
    }

    public function 
testEncode14() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x30720x30680x30640x5C4B0x68390x306E0x4E0B0x0032
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."2-u9tlzr9756bt3uc0v"$result);
    }

    public function 
testEncode15() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x004D0x00610x006A0x00690x30670x004B0x006F0x0069,
            
0x30590x308B0x00350x79D20x524D
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."majikoi5-783gue6qz075azm5e"$result);
    }

    public function 
testEncode16() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x30D10x30D50x30A30x30FC0x00640x00650x30EB0x30F30x30D0
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."de-jg4avhby1noc0d"$result);
    }

    public function 
testEncode17() {
        
// Japanese
        
$idna $this->hexarray2string(array(
            
0x305D0x306E0x30B90x30D40x30FC0x30C90x3067
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."d9juau41awczczp"$result);
    }

    public function 
testEncode18() {
        
// Greek
        
$idna $this->hexarray2string(array(
            
0x03b50x03bb0x03bb0x03b70x03bd0x03b90x03ba0x03ac
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."hxargifdar"$result);
    }

    public function 
testEncode19() {
        
// Maltese (Malti)
        
$idna $this->hexarray2string(array(
            
0x00620x006f0x006e0x01210x00750x00730x00610x0127,
            
0x01270x0061
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."bonusaa-5bb1da"$result);
    }

    public function 
testEncode20() {
        
// Russian (Cyrillic)
        
$idna $this->hexarray2string(array(
            
0x043f0x043e0x04470x04350x043c0x04430x04360x0435,
            
0x043e0x043d0x04380x043d0x04350x04330x043e0x0432,
            
0x043e0x04400x044f0x04420x043f0x043e0x04400x0443,
            
0x04410x04410x043a0x0438
        
));
        
$result $this->idn->encode($idna);
        
$this->assertSame(IDNA_ACE_PREFIX."b1abfaaepdrnnbgefbadotcwatmq2g4l"$result);
    }

}


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v.2.1 [PHP 7 Update] [1.12.2019] maintained by KaizenLouie and updated by cermmik | C99Shell Github (MySQL update) | Generation time: 0.0992 ]--