Guest User

Untitled

a guest
Jun 23rd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. <?php // this is "arraytest.php"
  2.  
  3. class arraytest{
  4. private $array1 = array();
  5. public function __construct(){
  6. $this->array1[] = 'poodle';
  7. }
  8. public function getarray(){
  9. return $this->array1;
  10. }
  11. }
  12.  
  13. class dododo{
  14. public $poop;
  15. public function __construct(){
  16. $poop = new arraytest();
  17. }
  18. public function foo()
  19. {echo 'bar';}
  20. }
  21.  
  22. ?>
  23.  
  24. <?php // this is page 1
  25. require_once('arraytest.php');
  26. session_start();
  27. $bob = new dododo();
  28. $_SESSION['bob'] = serialize($bob);
  29. ?>
  30.  
  31. <?php // this is page 2
  32. require_once('arraytest.php');
  33. session_start();
  34. $bob = unserialize($_SESSION['bob']);
  35. $bob->foo();
  36. print_r($bob->poop->getarray()); // This generates an error.
  37. ?>
  38.  
  39. public function __construct(){
  40. $this->poop = new arraytest();
  41. }
  42.  
  43. public function __construct(){
  44. $this->poop = new arraytest();
  45. }
Add Comment
Please, Sign In to add comment