xref: /PHP-7.4/Zend/tests/bug35634.phpt (revision 610c7fbe)
1--TEST--
2Bug #35634 (Erroneous "Class declarations may not be nested" error raised)
3--INI--
4error_reporting=0
5--FILE--
6<?php
7if (defined("pass3")) {
8
9  class ErrorClass {
10  }
11
12} else if (defined("pass2")) {
13
14  class TestClass {
15    function __construct() {
16    }
17    function TestClass() {
18      $this->__construct();
19    }
20  }
21
22} else {
23
24  function errorHandler($errorNumber, $errorMessage, $fileName, $lineNumber) {
25    define("pass3", 1);
26    include(__FILE__);
27    die("Error: $errorMessage ($fileName:$lineNumber)\n");
28  }
29
30  set_error_handler('errorHandler');
31  define("pass2", 1);
32  include(__FILE__);
33  print "ok\n";
34}
35
36?>
37--EXPECT--
38ok
39