1--TEST-- 2__sleep() returning undefined declared properties 3--FILE-- 4<?php 5 6class Test { 7 public $pub; 8 protected $prot; 9 private $priv; 10 11 public function __construct() { 12 unset($this->pub, $this->prot, $this->priv); 13 } 14 15 public function __sleep() { 16 return ['pub', 'prot', 'priv']; 17 } 18} 19 20var_dump(serialize(new Test)); 21 22?> 23--EXPECTF-- 24Notice: serialize(): "pub" returned as member variable from __sleep() but does not exist in %s on line %d 25 26Notice: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d 27 28Notice: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d 29string(53) "O:4:"Test":3:{s:3:"pub";N;s:4:"prot";N;s:4:"priv";N;}" 30