xref: /PHP-5.3/ext/curl/tests/bug46711.phpt (revision 13dce00c)
1--TEST--
2Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
3--SKIPIF--
4<?php
5if (!extension_loaded("curl")) {
6	exit("skip curl extension not loaded");
7}
8if (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
21curl_setopt( $ch, CURLOPT_AUTOREFERER  , TRUE );
22
23foreach( $opt as $option => $value ) {
24	curl_setopt( $ch, $option, $value );
25}
26
27var_dump($opt); // with this bug, $opt[58] becomes NULL
28
29?>
30--EXPECT--
31array(2) {
32  [58]=>
33  bool(true)
34  [19914]=>
35  bool(true)
36}
37