PHP  
 PHP_5_4
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Expected Test Failure Report for tests/classes/bug63462.phpt ('Test script to verify that magic methods should be called only once when accessing an unset property.')

Script

1: <?php
2:
class Test {
3:     public    
$publicProperty;
4:     protected 
$protectedProperty;
5:     private   
$privateProperty;
6:
7:     public function 
__construct() {
8:         unset(
9:             
$this->publicProperty,
10:             
$this->protectedProperty,
11:             
$this->privateProperty
12:         
);
13:     }
14:
15:     function 
__get($name) {
16:         echo 
'__get ' $name "\n";
17:         return 
$this->$name;
18:     }
19:
20:     function 
__set($name$value) {
21:         echo 
'__set ' $name "\n";
22:         
$this->$name $value;
23:     }
24:
25:     function 
__isset($name) {
26:         echo 
'__isset ' $name "\n";
27:         return isset(
$this->$name);
28:     }
29: }
30:
31:
$test = new Test();
32:
33:
$test->nonExisting;
34:
$test->publicProperty;
35:
$test->protectedProperty;
36:
$test->privateProperty;
37: isset(
$test->nonExisting);
38: isset(
$test->publicProperty);
39: isset(
$test->protectedProperty);
40: isset(
$test->privateProperty);
41:
$test->nonExisting       'value';
42:
$test->publicProperty     'value';
43:
$test->protectedProperty 'value';
44:
$test->privateProperty   'value';
45:
46:
?>
47:

48:

Expected

__get nonExisting
Notice: Undefined index: nonExisting in %__set__get_006.php on line %d
__get publicProperty
Notice: Undefined index: publicProperty in %__set__get_006.php on line %d
__get protectedProperty
Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d
__get privateProperty
Notice: Undefined index: privateProperty in %__set__get_006.php on line %d
__isset nonExisting
__isset publicProperty
__isset protectedProperty
__isset privateProperty
__set nonExisting
__set publicProperty
__set protectedProperty
__set privateProperty

Output

__get nonExisting

Notice: Undefined property: Test::$nonExisting in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
__get publicProperty

Notice: Undefined property: Test::$publicProperty in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
__get protectedProperty

Notice: Undefined property: Test::$protectedProperty in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
__get privateProperty

Notice: Undefined property: Test::$privateProperty in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
__isset nonExisting
__isset publicProperty
__isset protectedProperty
__isset privateProperty
__set nonExisting
__set publicProperty
__set protectedProperty
__set privateProperty

Diff

002+ 
003+ Notice: Undefined property: Test::$nonExisting in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
002- Notice: Undefined index: nonExisting in %__set__get_006.php on line %d
004- Notice: Undefined index: publicProperty in %__set__get_006.php on line %d
005+ 
006+ Notice: Undefined property: Test::$publicProperty in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
006- Notice: Undefined index: protectedProperty in %__set__get_006.php on line %d
008+ 
009+ Notice: Undefined property: Test::$protectedProperty in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17
008- Notice: Undefined index: privateProperty in %__set__get_006.php on line %d
011+ 
012+ Notice: Undefined property: Test::$privateProperty in /var/php_gcov/PHP_5_4/tests/classes/bug63462.php on line 17

 

Generated at Tue, 15 Jul 2014 20:53:37 +0000 (8 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.