Annotation of embedaddon/php/ext/xml/tests/bug50576.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #50576 (XML_OPTION_SKIP_TAGSTART option has no effect)
                      3: --SKIPIF--
                      4: <?php
                      5: require_once("skipif.inc");
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: $XML = <<<XML
                     11: <?xml version="1.0"?>
                     12: <ns1:listOfAwards xmlns:ns1="http://www.fpdsng.com/FPDS">
                     13: <ns1:count>
                     14: <ns1:total>867</ns1:total>
                     15: </ns1:count>
                     16: </ns1:listOfAwards>
                     17: XML;
                     18: 
                     19: $xml_parser = xml_parser_create();
                     20: xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
                     21: xml_parse_into_struct($xml_parser, $XML, $vals, $index);
                     22: echo 'Index array' . PHP_EOL;
                     23: print_r($index);
                     24: echo 'Vals array' . PHP_EOL;
                     25: print_r($vals);
                     26: xml_parser_free($xml_parser);
                     27: 
                     28: function startElement($parser, $name, $attribs) { echo $name . PHP_EOL; }
                     29: function endElement($parser, $name) { echo $name . PHP_EOL; }
                     30: $xml_parser = xml_parser_create();
                     31: xml_set_element_handler($xml_parser, 'startElement', 'endElement');
                     32: xml_parser_set_option($xml_parser, XML_OPTION_SKIP_TAGSTART, 4);
                     33: xml_parse($xml_parser, $XML);
                     34: xml_parser_free($xml_parser);
                     35: 
                     36: ?>
                     37: --EXPECTF--
                     38: Index array
                     39: Array
                     40: (
                     41:     [LISTOFAWARDS] => Array
                     42:         (
                     43:             [0] => 0
                     44:             [1] => 5
                     45:             [2] => 6
                     46:         )
                     47: 
                     48:     [COUNT] => Array
                     49:         (
                     50:             [0] => 1
                     51:             [1] => 3
                     52:             [2] => 4
                     53:         )
                     54: 
                     55:     [TOTAL] => Array
                     56:         (
                     57:             [0] => 2
                     58:         )
                     59: 
                     60: )
                     61: Vals array
                     62: Array
                     63: (
                     64:     [0] => Array
                     65:         (
                     66:             [tag] => LISTOFAWARDS
                     67:             [type] => open
                     68:             [level] => 1
                     69:             [attributes] => Array
                     70:                 (
                     71:                     [XMLNS:NS1] => http://www.fpdsng.com/FPDS
                     72:                 )
                     73: 
                     74:             [value] => 
                     75: 
                     76:         )
                     77: 
                     78:     [1] => Array
                     79:         (
                     80:             [tag] => COUNT
                     81:             [type] => open
                     82:             [level] => 2
                     83:             [value] => 
                     84: 
                     85:         )
                     86: 
                     87:     [2] => Array
                     88:         (
                     89:             [tag] => TOTAL
                     90:             [type] => complete
                     91:             [level] => 3
                     92:             [value] => 867
                     93:         )
                     94: 
                     95:     [3] => Array
                     96:         (
                     97:             [tag] => COUNT
                     98:             [value] => 
                     99: 
                    100:             [type] => cdata
                    101:             [level] => 2
                    102:         )
                    103: 
                    104:     [4] => Array
                    105:         (
                    106:             [tag] => COUNT
                    107:             [type] => close
                    108:             [level] => 2
                    109:         )
                    110: 
                    111:     [5] => Array
                    112:         (
                    113:             [tag] => LISTOFAWARDS
                    114:             [value] => 
                    115: 
                    116:             [type] => cdata
                    117:             [level] => 1
                    118:         )
                    119: 
                    120:     [6] => Array
                    121:         (
                    122:             [tag] => LISTOFAWARDS
                    123:             [type] => close
                    124:             [level] => 1
                    125:         )
                    126: 
                    127: )
                    128: LISTOFAWARDS
                    129: COUNT
                    130: TOTAL
                    131: TOTAL
                    132: COUNT
                    133: LISTOFAWARDS

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