Annotation of embedaddon/php/ext/standard/tests/strings/htmlspecialchars_decode_variation4.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Test htmlspecialchars_decode() function : usage variations - single quoted strings for 'string' argument
                      3: --FILE--
                      4: <?php
                      5: /* Prototype  : string htmlspecialchars_decode(string $string [, int $quote_style])
                      6:  * Description: Convert special HTML entities back to characters
                      7:  * Source code: ext/standard/html.c
                      8: */
                      9: 
                     10: /*
                     11:  * Testing htmlspecialchars_decode() with various single quoted strings as argument for $string
                     12: */
                     13: 
                     14: echo "*** Testing htmlspecialchars_decode() : usage variations ***\n";
                     15: 
                     16: //single quoted strings
                     17: $values = array (
                     18:   'Roy&#039s height &gt; Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;',
                     19:   'Roy&#039;s height &gt; Sam&#039;s height... \t\t 13 &lt; 15...\n\r &quot; double quote\f\v string &quot;',
                     20:   '\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f',
                     21:   '\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height',
                     22:   '\n 1\t3 &\tgt; 11 but 11 &\tlt; 12',
                     23: );
                     24:   
                     25: // loop through each element of the values array to check htmlspecialchars_decode() function with all possible arguments
                     26: $iterator = 1;
                     27: foreach($values as $value) {
                     28:       echo "-- Iteration $iterator --\n";
                     29:       var_dump( htmlspecialchars_decode($value) );
                     30:       var_dump( htmlspecialchars_decode($value, ENT_COMPAT) );
                     31:       var_dump( htmlspecialchars_decode($value, ENT_NOQUOTES) );
                     32:       var_dump( htmlspecialchars_decode($value, ENT_QUOTES) );
                     33:       $iterator++;
                     34: }
                     35: 
                     36: echo "Done";
                     37: ?>
                     38: --EXPECTF--
                     39: *** Testing htmlspecialchars_decode() : usage variations ***
                     40: -- Iteration 1 --
                     41: string(90) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... " double quote string ""
                     42: string(90) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... " double quote string ""
                     43: string(100) "Roy&#039s height > Sam&#039;s \$height... 1111 &ap; 0000 = 0000... &quot; double quote string &quot;"
                     44: string(85) "Roy&#039s height > Sam's \$height... 1111 &ap; 0000 = 0000... " double quote string ""
                     45: -- Iteration 2 --
                     46: string(88) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r " double quote\f\v string ""
                     47: string(88) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r " double quote\f\v string ""
                     48: string(98) "Roy&#039;s height > Sam&#039;s height... \t\t 13 < 15...\n\r &quot; double quote\f\v string &quot;"
                     49: string(78) "Roy's height > Sam's height... \t\t 13 < 15...\n\r " double quote\f\v string ""
                     50: -- Iteration 3 --
                     51: string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
                     52: string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
                     53: string(48) "\nRoy&#039;s height &gt\t; Sam&#039;s\v height\f"
                     54: string(38) "\nRoy's height &gt\t; Sam's\v height\f"
                     55: -- Iteration 4 --
                     56: string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
                     57: string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
                     58: string(48) "\r\tRoy&#039;s height &gt\r; Sam\t&#039;s height"
                     59: string(38) "\r\tRoy's height &gt\r; Sam\t's height"
                     60: -- Iteration 5 --
                     61: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
                     62: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
                     63: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
                     64: string(34) "\n 1\t3 &\tgt; 11 but 11 &\tlt; 12"
                     65: Done

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>