xref: /PHP-8.1/ext/curl/tests/bug46711.phpt (revision 39131219)
1--TEST--
2Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
3--EXTENSIONS--
4curl
5--FILE--
6<?php
7$ch = curl_init();
8
9$opt = array(
10    CURLOPT_AUTOREFERER  => TRUE,
11    CURLOPT_BINARYTRANSFER => TRUE
12);
13
14curl_setopt( $ch, CURLOPT_AUTOREFERER  , TRUE );
15
16foreach( $opt as $option => $value ) {
17    curl_setopt( $ch, $option, $value );
18}
19
20var_dump($opt); // with this bug, $opt[58] becomes NULL
21
22?>
23--EXPECT--
24array(2) {
25  [58]=>
26  bool(true)
27  [19914]=>
28  bool(true)
29}
30