1--TEST-- 2Unset property via error_handler 3--FILE-- 4<?php 5class C { 6 public $a; 7 8 public function errorHandler($errno, $errstr) { 9 var_dump($errstr); 10 unset($this->a); 11 } 12} 13 14$c = new C; 15set_error_handler([$c, 'errorHandler']); 16 17/* default property value */ 18var_dump(--$c->a); 19 20echo "NULL (only --)\n"; 21echo "POST DEC\n"; 22$c->a = null; 23var_dump($c->a--); 24unset($c->a); 25echo "PRE DEC\n"; 26$c->a = null; 27var_dump(--$c->a); 28unset($c->a); 29echo "Empty string\n"; 30echo "POST INC\n"; 31$c->a = ""; 32var_dump($c->a++); 33unset($c->a); 34echo "POST DEC\n"; 35$c->a = ""; 36var_dump($c->a--); 37unset($c->a); 38echo "PRE INC\n"; 39$c->a = ""; 40var_dump(++$c->a); 41unset($c->a); 42echo "PRE DEC\n"; 43$c->a = ""; 44var_dump(--$c->a); 45unset($c->a); 46echo "Non fill ASCII (only ++)\n"; 47echo "POST INC\n"; 48$c->a = " ad "; 49var_dump($c->a++); 50unset($c->a); 51echo "PRE INC\n"; 52$c->a = " ad "; 53var_dump(++$c->a); 54unset($c->a); 55echo "Bool\n"; 56echo "POST INC\n"; 57$c->a = false; 58var_dump($c->a++); 59unset($c->a); 60echo "POST DEC\n"; 61$c->a = false; 62var_dump($c->a--); 63unset($c->a); 64echo "PRE INC\n"; 65$c->a = false; 66var_dump(++$c->a); 67unset($c->a); 68echo "PRE DEC\n"; 69$c->a = false; 70var_dump(--$c->a); 71unset($c->a); 72echo "POST INC\n"; 73$c->a = true; 74var_dump($c->a++); 75unset($c->a); 76echo "POST DEC\n"; 77$c->a = true; 78var_dump($c->a--); 79unset($c->a); 80echo "PRE INC\n"; 81$c->a = true; 82var_dump(++$c->a); 83unset($c->a); 84echo "PRE DEC\n"; 85$c->a = true; 86var_dump(--$c->a); 87unset($c->a); 88?> 89--EXPECT-- 90string(87) "Decrement on type null has no effect, this will change in the next major version of PHP" 91NULL 92NULL (only --) 93POST DEC 94string(87) "Decrement on type null has no effect, this will change in the next major version of PHP" 95NULL 96PRE DEC 97string(87) "Decrement on type null has no effect, this will change in the next major version of PHP" 98NULL 99Empty string 100POST INC 101string(50) "Increment on non-alphanumeric string is deprecated" 102string(0) "" 103POST DEC 104string(54) "Decrement on empty string is deprecated as non-numeric" 105string(0) "" 106PRE INC 107string(50) "Increment on non-alphanumeric string is deprecated" 108string(1) "1" 109PRE DEC 110string(54) "Decrement on empty string is deprecated as non-numeric" 111int(-1) 112Non fill ASCII (only ++) 113POST INC 114string(50) "Increment on non-alphanumeric string is deprecated" 115string(4) " ad " 116PRE INC 117string(50) "Increment on non-alphanumeric string is deprecated" 118string(4) " ad " 119Bool 120POST INC 121string(87) "Increment on type bool has no effect, this will change in the next major version of PHP" 122bool(false) 123POST DEC 124string(87) "Decrement on type bool has no effect, this will change in the next major version of PHP" 125bool(false) 126PRE INC 127string(87) "Increment on type bool has no effect, this will change in the next major version of PHP" 128bool(false) 129PRE DEC 130string(87) "Decrement on type bool has no effect, this will change in the next major version of PHP" 131bool(false) 132POST INC 133string(87) "Increment on type bool has no effect, this will change in the next major version of PHP" 134bool(true) 135POST DEC 136string(87) "Decrement on type bool has no effect, this will change in the next major version of PHP" 137bool(true) 138PRE INC 139string(87) "Increment on type bool has no effect, this will change in the next major version of PHP" 140bool(true) 141PRE DEC 142string(87) "Decrement on type bool has no effect, this will change in the next major version of PHP" 143bool(true) 144