Annotation of embedaddon/php/ext/standard/tests/serialize/serialization_objects_015.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Object serialization / unserialization: properties reference containing object
! 3: --INI--
! 4: error_reporting = E_ALL & ~E_STRICT
! 5: --FILE--
! 6: <?php
! 7:
! 8: function check(&$obj) {
! 9: var_dump($obj);
! 10: $ser = serialize($obj);
! 11: var_dump($ser);
! 12:
! 13: $uobj = unserialize($ser);
! 14: var_dump($uobj);
! 15: $uobj->a = "obj->a.changed";
! 16: var_dump($uobj);
! 17: $uobj->b = "obj->b.changed";
! 18: var_dump($uobj);
! 19: $uobj->c = "obj->c.changed";
! 20: var_dump($uobj);
! 21: }
! 22:
! 23: echo "\n\n--- a refs container:\n";
! 24: $ext = 1;
! 25: $obj = new stdClass;
! 26: $obj->a = &$obj;
! 27: $obj->b = 1;
! 28: $obj->c = 1;
! 29: check($obj);
! 30:
! 31: echo "\n\n--- a eqs container:\n";
! 32: $ext = 1;
! 33: $obj = new stdClass;
! 34: $obj->a = $obj;
! 35: $obj->b = 1;
! 36: $obj->c = 1;
! 37: check($obj);
! 38:
! 39: echo "\n\n--- a,b ref container:\n";
! 40: $ext = 1;
! 41: $obj = new stdClass;
! 42: $obj->a = &$obj;
! 43: $obj->b = &$obj;
! 44: $obj->c = 1;
! 45: check($obj);
! 46:
! 47: echo "\n\n--- a,b eq container:\n";
! 48: $ext = 1;
! 49: $obj = new stdClass;
! 50: $obj->a = $obj;
! 51: $obj->b = $obj;
! 52: $obj->c = 1;
! 53: check($obj);
! 54:
! 55: echo "\n\n--- a,b,c ref container:\n";
! 56: $ext = 1;
! 57: $obj = new stdClass;
! 58: $obj->a = &$obj;
! 59: $obj->b = &$obj;
! 60: $obj->c = &$obj;
! 61: check($obj);
! 62:
! 63: echo "\n\n--- a,b,c eq container:\n";
! 64: $ext = 1;
! 65: $obj = new stdClass;
! 66: $obj->a = $obj;
! 67: $obj->b = $obj;
! 68: $obj->c = $obj;
! 69: check($obj);
! 70:
! 71: echo "Done";
! 72: ?>
! 73: --EXPECTF--
! 74: --- a refs container:
! 75: object(stdClass)#%d (3) {
! 76: ["a"]=>
! 77: *RECURSION*
! 78: ["b"]=>
! 79: int(1)
! 80: ["c"]=>
! 81: int(1)
! 82: }
! 83: string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";i:1;s:1:"c";i:1;}"
! 84: object(stdClass)#%d (3) {
! 85: ["a"]=>
! 86: *RECURSION*
! 87: ["b"]=>
! 88: int(1)
! 89: ["c"]=>
! 90: int(1)
! 91: }
! 92: object(stdClass)#%d (3) {
! 93: ["a"]=>
! 94: string(14) "obj->a.changed"
! 95: ["b"]=>
! 96: int(1)
! 97: ["c"]=>
! 98: int(1)
! 99: }
! 100: object(stdClass)#%d (3) {
! 101: ["a"]=>
! 102: string(14) "obj->a.changed"
! 103: ["b"]=>
! 104: string(14) "obj->b.changed"
! 105: ["c"]=>
! 106: int(1)
! 107: }
! 108: object(stdClass)#%d (3) {
! 109: ["a"]=>
! 110: string(14) "obj->a.changed"
! 111: ["b"]=>
! 112: string(14) "obj->b.changed"
! 113: ["c"]=>
! 114: string(14) "obj->c.changed"
! 115: }
! 116:
! 117:
! 118: --- a eqs container:
! 119: object(stdClass)#%d (3) {
! 120: ["a"]=>
! 121: *RECURSION*
! 122: ["b"]=>
! 123: int(1)
! 124: ["c"]=>
! 125: int(1)
! 126: }
! 127: string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";i:1;s:1:"c";i:1;}"
! 128: object(stdClass)#%d (3) {
! 129: ["a"]=>
! 130: *RECURSION*
! 131: ["b"]=>
! 132: int(1)
! 133: ["c"]=>
! 134: int(1)
! 135: }
! 136: object(stdClass)#%d (3) {
! 137: ["a"]=>
! 138: string(14) "obj->a.changed"
! 139: ["b"]=>
! 140: int(1)
! 141: ["c"]=>
! 142: int(1)
! 143: }
! 144: object(stdClass)#%d (3) {
! 145: ["a"]=>
! 146: string(14) "obj->a.changed"
! 147: ["b"]=>
! 148: string(14) "obj->b.changed"
! 149: ["c"]=>
! 150: int(1)
! 151: }
! 152: object(stdClass)#%d (3) {
! 153: ["a"]=>
! 154: string(14) "obj->a.changed"
! 155: ["b"]=>
! 156: string(14) "obj->b.changed"
! 157: ["c"]=>
! 158: string(14) "obj->c.changed"
! 159: }
! 160:
! 161:
! 162: --- a,b ref container:
! 163: object(stdClass)#%d (3) {
! 164: ["a"]=>
! 165: *RECURSION*
! 166: ["b"]=>
! 167: *RECURSION*
! 168: ["c"]=>
! 169: int(1)
! 170: }
! 171: string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";i:1;}"
! 172: object(stdClass)#%d (3) {
! 173: ["a"]=>
! 174: *RECURSION*
! 175: ["b"]=>
! 176: *RECURSION*
! 177: ["c"]=>
! 178: int(1)
! 179: }
! 180: object(stdClass)#%d (3) {
! 181: ["a"]=>
! 182: &string(14) "obj->a.changed"
! 183: ["b"]=>
! 184: &string(14) "obj->a.changed"
! 185: ["c"]=>
! 186: int(1)
! 187: }
! 188: object(stdClass)#%d (3) {
! 189: ["a"]=>
! 190: &string(14) "obj->b.changed"
! 191: ["b"]=>
! 192: &string(14) "obj->b.changed"
! 193: ["c"]=>
! 194: int(1)
! 195: }
! 196: object(stdClass)#%d (3) {
! 197: ["a"]=>
! 198: &string(14) "obj->b.changed"
! 199: ["b"]=>
! 200: &string(14) "obj->b.changed"
! 201: ["c"]=>
! 202: string(14) "obj->c.changed"
! 203: }
! 204:
! 205:
! 206: --- a,b eq container:
! 207: object(stdClass)#%d (3) {
! 208: ["a"]=>
! 209: *RECURSION*
! 210: ["b"]=>
! 211: *RECURSION*
! 212: ["c"]=>
! 213: int(1)
! 214: }
! 215: string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";i:1;}"
! 216: object(stdClass)#%d (3) {
! 217: ["a"]=>
! 218: *RECURSION*
! 219: ["b"]=>
! 220: *RECURSION*
! 221: ["c"]=>
! 222: int(1)
! 223: }
! 224: object(stdClass)#%d (3) {
! 225: ["a"]=>
! 226: string(14) "obj->a.changed"
! 227: ["b"]=>
! 228: *RECURSION*
! 229: ["c"]=>
! 230: int(1)
! 231: }
! 232: object(stdClass)#%d (3) {
! 233: ["a"]=>
! 234: string(14) "obj->a.changed"
! 235: ["b"]=>
! 236: string(14) "obj->b.changed"
! 237: ["c"]=>
! 238: int(1)
! 239: }
! 240: object(stdClass)#%d (3) {
! 241: ["a"]=>
! 242: string(14) "obj->a.changed"
! 243: ["b"]=>
! 244: string(14) "obj->b.changed"
! 245: ["c"]=>
! 246: string(14) "obj->c.changed"
! 247: }
! 248:
! 249:
! 250: --- a,b,c ref container:
! 251: object(stdClass)#%d (3) {
! 252: ["a"]=>
! 253: *RECURSION*
! 254: ["b"]=>
! 255: *RECURSION*
! 256: ["c"]=>
! 257: *RECURSION*
! 258: }
! 259: string(55) "O:8:"stdClass":3:{s:1:"a";R:1;s:1:"b";R:1;s:1:"c";R:1;}"
! 260: object(stdClass)#%d (3) {
! 261: ["a"]=>
! 262: *RECURSION*
! 263: ["b"]=>
! 264: *RECURSION*
! 265: ["c"]=>
! 266: *RECURSION*
! 267: }
! 268: object(stdClass)#%d (3) {
! 269: ["a"]=>
! 270: &string(14) "obj->a.changed"
! 271: ["b"]=>
! 272: &string(14) "obj->a.changed"
! 273: ["c"]=>
! 274: &string(14) "obj->a.changed"
! 275: }
! 276: object(stdClass)#%d (3) {
! 277: ["a"]=>
! 278: &string(14) "obj->b.changed"
! 279: ["b"]=>
! 280: &string(14) "obj->b.changed"
! 281: ["c"]=>
! 282: &string(14) "obj->b.changed"
! 283: }
! 284: object(stdClass)#%d (3) {
! 285: ["a"]=>
! 286: &string(14) "obj->c.changed"
! 287: ["b"]=>
! 288: &string(14) "obj->c.changed"
! 289: ["c"]=>
! 290: &string(14) "obj->c.changed"
! 291: }
! 292:
! 293:
! 294: --- a,b,c eq container:
! 295: object(stdClass)#%d (3) {
! 296: ["a"]=>
! 297: *RECURSION*
! 298: ["b"]=>
! 299: *RECURSION*
! 300: ["c"]=>
! 301: *RECURSION*
! 302: }
! 303: string(55) "O:8:"stdClass":3:{s:1:"a";r:1;s:1:"b";r:1;s:1:"c";r:1;}"
! 304: object(stdClass)#%d (3) {
! 305: ["a"]=>
! 306: *RECURSION*
! 307: ["b"]=>
! 308: *RECURSION*
! 309: ["c"]=>
! 310: *RECURSION*
! 311: }
! 312: object(stdClass)#%d (3) {
! 313: ["a"]=>
! 314: string(14) "obj->a.changed"
! 315: ["b"]=>
! 316: *RECURSION*
! 317: ["c"]=>
! 318: *RECURSION*
! 319: }
! 320: object(stdClass)#%d (3) {
! 321: ["a"]=>
! 322: string(14) "obj->a.changed"
! 323: ["b"]=>
! 324: string(14) "obj->b.changed"
! 325: ["c"]=>
! 326: *RECURSION*
! 327: }
! 328: object(stdClass)#%d (3) {
! 329: ["a"]=>
! 330: string(14) "obj->a.changed"
! 331: ["b"]=>
! 332: string(14) "obj->b.changed"
! 333: ["c"]=>
! 334: string(14) "obj->c.changed"
! 335: }
! 336: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>