1--TEST--
2Inc/dec on string: warning/deprecations converted to exception
3--FILE--
4<?php
5
6set_error_handler(function($severity, $m) {
7    if ($severity == E_DEPRECATED) {
8        $m = 'Deprecated: ' . $m;
9    }
10    if ($severity == E_WARNING) {
11        $m = 'Warning: ' . $m;
12    }
13    throw new Exception($m, $severity);
14});
15
16$values = [
17    '',
18    ' ',
19    // Alphanumeric values
20    '199A',
21    'A199',
22    '199Z',
23    'Z199',
24    // Strings
25    'Hello world',
26    '��'
27];
28foreach ($values as $value) {
29    try {
30        $value++;
31    } catch (\Exception $e) {
32        echo $e->getMessage(), PHP_EOL;
33    }
34    var_dump($value);
35    try {
36        $value--;
37    } catch (\Exception $e) {
38        echo $e->getMessage(), PHP_EOL;
39    }
40    var_dump($value);
41}
42?>
43--EXPECT--
44Deprecated: Increment on non-alphanumeric string is deprecated
45string(0) ""
46Deprecated: Decrement on empty string is deprecated as non-numeric
47string(0) ""
48Deprecated: Increment on non-alphanumeric string is deprecated
49string(1) " "
50Deprecated: Decrement on non-numeric string has no effect and is deprecated
51string(1) " "
52string(4) "199B"
53Deprecated: Decrement on non-numeric string has no effect and is deprecated
54string(4) "199B"
55string(4) "A200"
56Deprecated: Decrement on non-numeric string has no effect and is deprecated
57string(4) "A200"
58string(4) "200A"
59Deprecated: Decrement on non-numeric string has no effect and is deprecated
60string(4) "200A"
61string(4) "Z200"
62Deprecated: Decrement on non-numeric string has no effect and is deprecated
63string(4) "Z200"
64Deprecated: Increment on non-alphanumeric string is deprecated
65string(11) "Hello world"
66Deprecated: Decrement on non-numeric string has no effect and is deprecated
67string(11) "Hello world"
68Deprecated: Increment on non-alphanumeric string is deprecated
69string(4) "��"
70Deprecated: Decrement on non-numeric string has no effect and is deprecated
71string(4) "��"
72