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-- 24Warning: serialize(): "pub" returned as member variable from __sleep() but does not exist in %s on line %d 25 26Warning: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d 27 28Warning: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d 29string(15) "O:4:"Test":0:{}" 30