xref: /php-src/Zend/tests/property_hooks/set.phpt (revision 780a8280)
1--TEST--
2Basic set only property hook
3--FILE--
4<?php
5
6class Test {
7    public $_prop;
8    public $prop {
9        set { $this->_prop = $value; }
10    }
11}
12
13$test = new Test;
14$test->prop = 42;
15var_dump($test->_prop);
16
17try {
18    var_dump($test->prop);
19} catch (Error $e) {
20    echo $e->getMessage(), "\n";
21}
22try {
23    var_dump(isset($test->prop));
24} catch (Error $e) {
25    echo $e->getMessage(), "\n";
26}
27
28?>
29--EXPECT--
30int(42)
31Property Test::$prop is write-only
32Property Test::$prop is write-only
33