Annotation of embedaddon/php/ext/curl/tests/bug46711.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
        !             3: --SKIPIF--
        !             4: <?php 
        !             5: if (!extension_loaded("curl")) {
        !             6:        exit("skip curl extension not loaded");
        !             7: }
        !             8: if (false === getenv('PHP_CURL_HTTP_REMOTE_SERVER'))  {
        !             9:        exit("skip PHP_CURL_HTTP_REMOTE_SERVER env variable is not defined");
        !            10: }
        !            11: ?>
        !            12: --FILE--
        !            13: <?php
        !            14: $ch = curl_init();
        !            15: 
        !            16: $opt = array(
        !            17:        CURLOPT_AUTOREFERER  => TRUE,
        !            18:        CURLOPT_BINARYTRANSFER => TRUE
        !            19: );
        !            20: 
        !            21: curl_setopt( $ch, CURLOPT_AUTOREFERER  , TRUE );
        !            22: 
        !            23: foreach( $opt as $option => $value ) {
        !            24:        curl_setopt( $ch, $option, $value );
        !            25: }
        !            26: 
        !            27: var_dump($opt); // with this bug, $opt[58] becomes NULL
        !            28: 
        !            29: ?>
        !            30: --EXPECT--
        !            31: array(2) {
        !            32:   [58]=>
        !            33:   bool(true)
        !            34:   [19914]=>
        !            35:   bool(true)
        !            36: }

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