xref: /PHP-7.2/Zend/tests/bug50261.phpt (revision 17ccbeec)
1--TEST--
2Bug #50261 (Crash When Calling Parent Constructor with call_user_func())
3--FILE--
4<?php
5
6class testClass {
7	function testClass($x) {
8		echo __METHOD__, " (". $x . ")\n";
9	}
10}
11
12class testClass2 extends testClass {
13	function __construct() {
14		static $x = 0;
15
16		if ($x) {
17			print "Infinite loop...\n";
18		} else {
19			$x++;
20
21			parent::__construct(1);
22			testclass::__construct(2);
23			call_user_func(array('parent', '__construct'), 3);
24			call_user_func(array('testclass', '__construct'), 4);
25			call_user_func(array('testclass', 'testclass'), 5);
26		}
27	}
28}
29
30new testClass2;
31
32?>
33--EXPECTF--
34Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; testClass has a deprecated constructor in %s on line %d
35testClass::testClass (1)
36testClass::testClass (2)
37testClass::testClass (3)
38testClass::testClass (4)
39testClass::testClass (5)
40