Return to serialization_objects_010.phpt CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / serialize |
1.1 misho 1: --TEST-- 2: Serialize() must return a string or NULL 3: --SKIPIF-- 4: <?php if (!interface_exists('Serializable')) die('skip Interface Serialzable not defined'); ?> 5: --FILE-- 6: <?php 7: /* Prototype : proto string serialize(mixed variable) 8: * Description: Returns a string representation of variable (which can later be unserialized) 9: * Source code: ext/standard/var.c 10: * Alias to functions: 11: */ 12: /* Prototype : proto mixed unserialize(string variable_representation) 13: * Description: Takes a string representation of variable and recreates it 14: * Source code: ext/standard/var.c 15: * Alias to functions: 16: */ 17: 18: Class C implements Serializable { 19: public function serialize() { 20: return $this; 21: } 22: 23: public function unserialize($blah) { 24: } 25: } 26: 27: try { 28: var_dump(serialize(new C)); 29: } catch (Exception $e) { 30: echo $e->getMessage(). "\n"; 31: } 32: 33: echo "Done"; 34: ?> 35: --EXPECTF-- 36: C::serialize() must return a string or NULL 37: Done