]> granicus.if.org Git - php/commitdiff
- Add missing test
authorJani Taskinen <jani@php.net>
Thu, 30 Apr 2009 10:41:09 +0000 (10:41 +0000)
committerJani Taskinen <jani@php.net>
Thu, 30 Apr 2009 10:41:09 +0000 (10:41 +0000)
ext/curl/tests/bug45161.phpt
ext/curl/tests/bug46711.phpt [new file with mode: 0644]

index eab1fd46e310e90b787f928d8e4370ba79fe8a37..46d981054c2920b71afaf9e42a37b362aeead2a6 100644 (file)
@@ -1,5 +1,7 @@
 --TEST--
 Bug #45161 (Reusing a curl handle leaks memory)
+--SKIPIF--
+<?php $curl_version = curl_version(); if ($curl_version['version_number'] < 0x071100) die("skip: test works only with curl >= 7.17.0"); ?>
 --FILE--
 <?php
 
diff --git a/ext/curl/tests/bug46711.phpt b/ext/curl/tests/bug46711.phpt
new file mode 100644 (file)
index 0000000..ac8f041
--- /dev/null
@@ -0,0 +1,27 @@
+--TEST--
+Bug #46711 (lost memory when foreach is used for values passed to curl_setopt())
+--FILE--
+<?php
+$ch = curl_init();
+
+$opt = array(
+       CURLOPT_AUTOREFERER  => TRUE,
+       CURLOPT_BINARYTRANSFER => TRUE
+);
+
+curl_setopt( $ch, CURLOPT_AUTOREFERER  , TRUE );
+
+foreach( $opt as $option => $value ) {
+       curl_setopt( $ch, $option, $value );
+}
+
+var_dump($opt); // with this bug, $opt[58] becomes NULL
+
+?>
+--EXPECT--
+array(2) {
+  [58]=>
+  bool(true)
+  [19914]=>
+  bool(true)
+}