xref: /PHP-5.6/ext/curl/tests/bug46711.phpt (revision c507c9f0)
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}
8?>
9--FILE--
10<?php
11$ch = curl_init();
12
13$opt = array(
14	CURLOPT_AUTOREFERER  => TRUE,
15	CURLOPT_BINARYTRANSFER => TRUE
16);
17
18curl_setopt( $ch, CURLOPT_AUTOREFERER  , TRUE );
19
20foreach( $opt as $option => $value ) {
21	curl_setopt( $ch, $option, $value );
22}
23
24var_dump($opt); // with this bug, $opt[58] becomes NULL
25
26?>
27--EXPECT--
28array(2) {
29  [58]=>
30  bool(true)
31  [19914]=>
32  bool(true)
33}
34