bug52827.phpt 743 B

123456789101112131415161718192021222324252627
  1. --TEST--
  2. Bug #52827 (curl_setopt with CURLOPT_STDERR erroneously increments the resource refcount)
  3. --EXTENSIONS--
  4. curl
  5. --FILE--
  6. <?php
  7. $s = fopen('php://temp/maxmemory=1024','wb+');
  8. /* force conversion of inner stream to STDIO.
  9. * This is not necessary in Windows because the
  10. * cast to a FILE* handle in curl_setopt already
  11. * forces the conversion in that platform. The
  12. * reason for this conversion is that the memory
  13. * stream has an ugly but working mechanism to
  14. * prevent being double freed when it's encapsulated,
  15. * while STDIO streams don't. */
  16. $i = 0;
  17. while ($i++ < 5000) {
  18. fwrite($s, str_repeat('a',1024));
  19. }
  20. $handle=curl_init('http://www.example.com');
  21. curl_setopt($handle, CURLOPT_STDERR, $s);
  22. echo "Done.";
  23. ?>
  24. --EXPECT--
  25. Done.