1--TEST--
2Test serialize() & unserialize() functions: objects (abstract classes)
3--INI--
4serialize_precision=100
5--FILE--
6<?php
7echo "\n--- Testing Abstract Class ---\n";
8// abstract class
9abstract class Name
10{
11  public function __construct() {
12    $this->a = 10;
13    $this->b = 12.222;
14    $this->c = "string";
15  }
16  abstract protected function getClassName();
17  public function printClassName () {
18    return $this->getClassName();
19  }
20}
21// implement abstract class
22class extendName extends Name
23{
24  var $a, $b, $c;
25
26  protected function getClassName() {
27    return "extendName";
28  }
29}
30
31$obj_extendName = new extendName();
32$serialize_data = serialize($obj_extendName);
33var_dump( $serialize_data );
34$unserialize_data = unserialize($serialize_data);
35var_dump( $unserialize_data );
36
37$serialize_data = serialize($obj_extendName->printClassName());
38var_dump( $serialize_data );
39$unserialize_data = unserialize($serialize_data);
40var_dump( $unserialize_data );
41
42echo "\nDone";
43?>
44--EXPECTF--
45--- Testing Abstract Class ---
46string(119) "O:10:"extendName":3:{s:1:"a";i:10;s:1:"b";d:12.2219999999999995310417943983338773250579833984375;s:1:"c";s:6:"string";}"
47object(extendName)#%d (3) {
48  ["a"]=>
49  int(10)
50  ["b"]=>
51  float(12.2219999999999995310417943983338773250579833984375)
52  ["c"]=>
53  string(6) "string"
54}
55string(18) "s:10:"extendName";"
56string(10) "extendName"
57
58Done
59