bug68799.phpt 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. --TEST--
  2. Bug #68799 (Free called on uninitialized pointer)
  3. --EXTENSIONS--
  4. exif
  5. --FILE--
  6. <?php
  7. /*
  8. * Pollute the heap. Helps trigger bug. Sometimes not needed.
  9. */
  10. class A {
  11. function __construct() {
  12. $a = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa';
  13. $this->a = $a . $a . $a . $a . $a . $a;
  14. }
  15. };
  16. function doStuff ($limit) {
  17. $a = new A;
  18. $b = array();
  19. for ($i = 0; $i < $limit; $i++) {
  20. $b[$i] = clone $a;
  21. }
  22. unset($a);
  23. gc_collect_cycles();
  24. }
  25. $iterations = 3;
  26. doStuff($iterations);
  27. doStuff($iterations);
  28. gc_collect_cycles();
  29. print_r(exif_read_data(__DIR__.'/bug68799.jpg'));
  30. ?>
  31. --EXPECTF--
  32. Array
  33. (
  34. [FileName] => bug68799.jpg
  35. [FileDateTime] => %d
  36. [FileSize] => 735
  37. [FileType] => 2
  38. [MimeType] => image/jpeg
  39. [SectionsFound] => ANY_TAG, IFD0, WINXP
  40. [COMPUTED] => Array
  41. (
  42. [html] => width="1" height="1"
  43. [Height] => 1
  44. [Width] => 1
  45. [IsColor] => 1
  46. [ByteOrderMotorola] => 1
  47. )
  48. [XResolution] => 96/1
  49. [YResolution] => 96/1
  50. [ResolutionUnit] => 2
  51. [Author] =>
  52. )