Annotation of embedaddon/php/ext/standard/tests/serialize/serialization_objects_005.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Check behaviour of incomplete class
        !             3: --FILE--
        !             4: <?php
        !             5: /* Prototype  : proto string serialize(mixed variable)
        !             6:  * Description: Returns a string representation of variable (which can later be unserialized) 
        !             7:  * Source code: ext/standard/var.c
        !             8:  * Alias to functions: 
        !             9:  */
        !            10: /* Prototype  : proto mixed unserialize(string variable_representation)
        !            11:  * Description: Takes a string representation of variable and recreates it 
        !            12:  * Source code: ext/standard/var.c
        !            13:  * Alias to functions: 
        !            14:  */
        !            15: 
        !            16: $serialized = 'O:1:"C":1:{s:1:"p";i:1;}';
        !            17: 
        !            18: $incomplete = unserialize($serialized);
        !            19: eval('Class C {}');
        !            20: $complete   = unserialize($serialized);
        !            21: 
        !            22: 
        !            23: echo "\n\n---> Various types of access on complete class:\n" ;
        !            24: var_dump($complete);
        !            25: var_dump(is_object($complete));
        !            26: var_dump($complete->p);
        !            27: 
        !            28: $ref1 = "ref1.original";
        !            29: $complete->p = &$ref1;
        !            30: var_dump($complete->p);
        !            31: $ref1 = "ref1.changed";
        !            32: var_dump($complete->p);
        !            33: $complete->p = "p.changed";
        !            34: var_dump($ref1);
        !            35: 
        !            36: var_dump(isset($complete->x));
        !            37: $complete->x = "x.new";
        !            38: var_dump(isset($complete->x));
        !            39: unset($complete->x);
        !            40: var_dump($complete->x);
        !            41: 
        !            42: 
        !            43: echo "\n\n---> Same types of access on incomplete class:\n" ;
        !            44: var_dump($incomplete);
        !            45: var_dump(is_object($incomplete));
        !            46: var_dump($incomplete->p);
        !            47: 
        !            48: $ref2 = "ref1.original";
        !            49: $incomplete->p = &$ref2;
        !            50: var_dump($incomplete->p);
        !            51: $ref2 = "ref1.changed";
        !            52: var_dump($incomplete->p);
        !            53: $incomplete->p = "p.changed";
        !            54: var_dump($ref1);
        !            55: 
        !            56: var_dump(isset($incomplete->x));
        !            57: $incomplete->x = "x.new";
        !            58: var_dump(isset($incomplete->x));
        !            59: unset($incomplete->x);
        !            60: var_dump($incomplete->x);
        !            61: 
        !            62: $incomplete->f();
        !            63: 
        !            64: echo "Done";
        !            65: ?>
        !            66: --EXPECTF--
        !            67: ---> Various types of access on complete class:
        !            68: object(C)#%d (1) {
        !            69:   ["p"]=>
        !            70:   int(1)
        !            71: }
        !            72: bool(true)
        !            73: int(1)
        !            74: string(13) "ref1.original"
        !            75: string(12) "ref1.changed"
        !            76: string(9) "p.changed"
        !            77: bool(false)
        !            78: bool(true)
        !            79: 
        !            80: Notice: Undefined property: C::$x in %s on line 37
        !            81: NULL
        !            82: 
        !            83: 
        !            84: ---> Same types of access on incomplete class:
        !            85: object(__PHP_Incomplete_Class)#%d (2) {
        !            86:   ["__PHP_Incomplete_Class_Name"]=>
        !            87:   string(1) "C"
        !            88:   ["p"]=>
        !            89:   int(1)
        !            90: }
        !            91: bool(false)
        !            92: 
        !            93: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 43
        !            94: NULL
        !            95: 
        !            96: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 46
        !            97: 
        !            98: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 47
        !            99: NULL
        !           100: 
        !           101: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 49
        !           102: NULL
        !           103: 
        !           104: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 50
        !           105: string(9) "p.changed"
        !           106: 
        !           107: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 53
        !           108: bool(false)
        !           109: 
        !           110: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 54
        !           111: 
        !           112: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 55
        !           113: bool(false)
        !           114: 
        !           115: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 56
        !           116: 
        !           117: Notice: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 57
        !           118: NULL
        !           119: 
        !           120: Fatal error: main(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition "C" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide a __autoload() function to load the class definition  in %s on line 59

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>