xref: /php-src/Zend/tests/oss_fuzz_63802.phpt (revision ddabe89a)
1--TEST--
2oss-fuzz #63802: OP1 leak in error path of post inc/dec
3--FILE--
4<?php
5class Foo {
6    public function preInc() {
7        ++$this > 42;
8    }
9    public function preDec() {
10        --$this > 42;
11    }
12    public function postInc() {
13        $this++ > 42;
14    }
15    public function postDec() {
16        $this-- > 42;
17    }
18}
19$foo = new Foo();
20foreach (['pre', 'post'] as $prePost) {
21    foreach (['inc', 'dec'] as $incDec) {
22        try {
23            $foo->{$prePost . ucfirst($incDec)}();
24        } catch (TypeError $e) {
25            echo $e->getMessage(), "\n";
26        }
27    }
28}
29?>
30--EXPECT--
31Cannot increment Foo
32Cannot decrement Foo
33Cannot increment Foo
34Cannot decrement Foo
35