Skip to content

Instantly share code, notes, and snippets.

@olesku
Created August 28, 2013 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olesku/6365029 to your computer and use it in GitHub Desktop.
Save olesku/6365029 to your computer and use it in GitHub Desktop.
zend_mm_heap corrupted reproduce script
<?php
define('OBJECT_COUNT', 20 * 1000);
class Object {
private static $world = array();
private static $maxGuid = 0;
protected $_guid = null;
public function __construct() {
self::$world[$this->_guid = self::$maxGuid++] = $this;
}
public function __destruct() {
unset(self::$world[$this->_guid]);
}
}
for ($i = 0; $i < OBJECT_COUNT; ++$i) {
new Object();
}
// You probably won't see this because of the "zend_mm_heap corrupted"
echo 'If you see this, try to increase OBJECT_COUNT to 100,000';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment