xref: /php-src/ext/opcache/tests/bug74442.phpt (revision 330cc5cd)
1--TEST--
2Bug #74442: Opcached version produces a nested array
3--CREDITS--
4Eric Norris <erictnorris@gmail.com>
5--EXTENSIONS--
6opcache
7--FILE--
8<?php
9class Schema_Base {
10    public function addField($typeclass, ?array $params = null) {
11        $field = new $typeclass($params);
12        return $field;
13    }
14}
15
16class Field_Base {
17    public function __construct(?array $params = null) {
18        if (! is_array($params)) {
19            $params = (array) $params;
20        }
21        call_user_func_array(array($this, 'acceptParams'), $params);
22    }
23}
24
25class Field_Integer extends Field_Base {
26    protected function acceptParams($bytes = 4) {
27        echo print_r($bytes, true);
28    }
29}
30
31try {
32    $schema = new Schema_Base;
33    $schema->addField('Field_Integer');
34} catch (Throwable $ex) {
35    echo "CAUGHT EXCEPTION";
36    echo (string)$ex;
37}
38
39?>
40--EXPECT--
414
42