diff options
author | Felipe Pena <felipe@php.net> | 2011-01-28 21:19:09 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2011-01-28 21:19:09 +0000 |
commit | f6a3cd6f5733345caf34109198d17c4a873ff7ae (patch) | |
tree | bad9d255b3f334965cac4711397989cb89b8d985 /Zend/tests/bug53748.phpt | |
parent | 0e7c00f3a64796d3f0a13330f8037e50fb7e2dec (diff) | |
download | php-git-f6a3cd6f5733345caf34109198d17c4a873ff7ae.tar.gz |
- Fixed bug #53748 (Using traits lead to a segmentation fault)
Diffstat (limited to 'Zend/tests/bug53748.phpt')
-rw-r--r-- | Zend/tests/bug53748.phpt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Zend/tests/bug53748.phpt b/Zend/tests/bug53748.phpt new file mode 100644 index 0000000000..2f171fe455 --- /dev/null +++ b/Zend/tests/bug53748.phpt @@ -0,0 +1,39 @@ +--TEST-- +Bug #53748 (Using traits lead to a segmentation fault) +--FILE-- +<?php + +trait Singleton { + protected static $instances=array(); + abstract protected function __construct($config); + public static function getInstance($config) { + if (!isset(self::$instances[$serialize = serialize($config)])) { + self::$instances[$serialize] = new self($config); + } + return self::$instances[$serialize]; + } +} + +class MyHelloWorld { + use Singleton; + public function __construct($config) + { + var_dump( $config); + } +} + + +$o= myHelloWorld::getInstance(1); +$o= myHelloWorld::getInstance(1); +$o= myHelloWorld::getInstance(2); +$o= myHelloWorld::getInstance(array(1=>2)); +$o= myHelloWorld::getInstance(array(1=>2)); + +?> +--EXPECTF-- +int(1) +int(2) +array(1) { + [1]=> + int(2) +} |