Annotation of embedaddon/php/ext/standard/tests/url/parse_url_variation_002_64bit.phpt, revision 1.1.1.2

1.1       misho       1: --TEST--
                      2: Test parse_url() function : usage variations  - unexpected type for arg 2.
                      3: --SKIPIF--
                      4: <?php if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platforms only"); ?>
                      5: --FILE--
                      6: <?php
                      7: /* Prototype  : proto mixed parse_url(string url, [int url_component])
                      8:  * Description: Parse a URL and return its components 
                      9:  * Source code: ext/standard/url.c
                     10:  * Alias to functions: 
                     11:  */
                     12: 
                     13: function test_error_handler($err_no, $err_msg, $filename, $linenum, $vars) {
                     14:        echo "Error: $err_no - $err_msg, $filename($linenum)\n";
                     15: }
                     16: set_error_handler('test_error_handler');
                     17: 
                     18: echo "*** Testing parse_url() : usage variations ***\n";
                     19: 
                     20: // Initialise function arguments not being substituted (if any)
                     21: $url = 'http://secret:hideout@www.php.net:80/index.php?test=1&test2=char&test3=mixesCI#some_page_ref123';
                     22: 
                     23: //get an unset variable
                     24: $unset_var = 10;
                     25: unset ($unset_var);
                     26: 
                     27: //array of values to iterate over
                     28: $values = array(
                     29: 
                     30:       // float data
                     31:       10.5,
                     32:       -10.5,
                     33:       10.1234567e10,
                     34:       10.7654321E-10,
                     35:       .5,
                     36: 
                     37:       // array data
                     38:       array(),
                     39:       array(0),
                     40:       array(1),
                     41:       array(1, 2),
                     42:       array('color' => 'red', 'item' => 'pen'),
                     43: 
                     44:       // null data
                     45:       NULL,
                     46:       null,
                     47: 
                     48:       // boolean data
                     49:       true,
                     50:       false,
                     51:       TRUE,
                     52:       FALSE,
                     53: 
                     54:       // empty data
                     55:       "",
                     56:       '',
                     57: 
                     58:       // string data
                     59:       "string",
                     60:       'string',
                     61: 
                     62:       // object data
                     63:       new stdclass(),
                     64: 
                     65:       // undefined data
                     66:       $undefined_var,
                     67: 
                     68:       // unset data
                     69:       $unset_var,
                     70: );
                     71: 
                     72: // loop through each element of the array for url_component
                     73: 
                     74: foreach($values as $value) {
                     75:       echo "\nArg value $value \n";
                     76:       var_dump( parse_url($url, $value) );
                     77: };
                     78: 
                     79: echo "Done";
                     80: ?>
                     81: --EXPECTF--
                     82: *** Testing parse_url() : usage variations ***
                     83: Error: 8 - Undefined variable: undefined_var, %s(61)
                     84: Error: 8 - Undefined variable: unset_var, %s(64)
                     85: 
                     86: Arg value 10.5 
                     87: Error: 2 - parse_url(): Invalid URL component identifier 10, %s(71)
                     88: bool(false)
                     89: 
                     90: Arg value -10.5 
                     91: array(8) {
                     92:   ["scheme"]=>
                     93:   string(4) "http"
                     94:   ["host"]=>
                     95:   string(11) "www.php.net"
                     96:   ["port"]=>
                     97:   int(80)
                     98:   ["user"]=>
                     99:   string(6) "secret"
                    100:   ["pass"]=>
                    101:   string(7) "hideout"
                    102:   ["path"]=>
                    103:   string(10) "/index.php"
                    104:   ["query"]=>
                    105:   string(31) "test=1&test2=char&test3=mixesCI"
                    106:   ["fragment"]=>
                    107:   string(16) "some_page_ref123"
                    108: }
                    109: 
                    110: Arg value 101234567000 
                    111: Error: 2 - parse_url(): Invalid URL component identifier %d, %s(71)
                    112: bool(false)
                    113: 
                    114: Arg value 1.07654321E-9 
                    115: string(4) "http"
                    116: 
                    117: Arg value 0.5 
                    118: string(4) "http"
1.1.1.2 ! misho     119: Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d)
1.1       misho     120: 
                    121: Arg value Array 
                    122: Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
                    123: NULL
1.1.1.2 ! misho     124: Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d)
1.1       misho     125: 
                    126: Arg value Array 
                    127: Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
                    128: NULL
1.1.1.2 ! misho     129: Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d)
1.1       misho     130: 
                    131: Arg value Array 
                    132: Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
                    133: NULL
1.1.1.2 ! misho     134: Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d)
1.1       misho     135: 
                    136: Arg value Array 
                    137: Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
                    138: NULL
1.1.1.2 ! misho     139: Error: 8 - Array to string conversion, %sparse_url_variation_002_64bit.php(%d)
1.1       misho     140: 
                    141: Arg value Array 
                    142: Error: 2 - parse_url() expects parameter 2 to be long, array given, %s(71)
                    143: NULL
                    144: 
                    145: Arg value  
                    146: string(4) "http"
                    147: 
                    148: Arg value  
                    149: string(4) "http"
                    150: 
                    151: Arg value 1 
                    152: string(11) "www.php.net"
                    153: 
                    154: Arg value  
                    155: string(4) "http"
                    156: 
                    157: Arg value 1 
                    158: string(11) "www.php.net"
                    159: 
                    160: Arg value  
                    161: string(4) "http"
                    162: 
                    163: Arg value  
                    164: Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
                    165: NULL
                    166: 
                    167: Arg value  
                    168: Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
                    169: NULL
                    170: 
                    171: Arg value string 
                    172: Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
                    173: NULL
                    174: 
                    175: Arg value string 
                    176: Error: 2 - parse_url() expects parameter 2 to be long, string given, %s(71)
                    177: NULL
                    178: Error: 4096 - Object of class stdClass could not be converted to string, %s(70)
                    179: 
                    180: Arg value  
                    181: Error: 2 - parse_url() expects parameter 2 to be long, object given, %s(71)
                    182: NULL
                    183: 
                    184: Arg value  
                    185: string(4) "http"
                    186: 
                    187: Arg value  
                    188: string(4) "http"
                    189: Done

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