<?php # Given two classes with the same property name but different visibility class WithPublic { public $property; function __construct( $p ) { $this->property = $p; } function getProperty() { return $this->property; } } class WithPrivate { private $property; function __construct( $p ) { $this->property = $p; } function getProperty() { return $this->property; } } $priv = new WithPrivate( 'value' ); $cache = serialize( $priv ); $mut_priv_to_pub = unserialize( str_replace( '11:"WithPrivate"', '10:"WithPublic"', $cache) ); var_dump( $mut_priv_to_pub ); # class WithPublic#4 (2) { # public $property => # NULL # private $property => # string(5) "value" # } var_export( $mut_priv_to_pub->getProperty() ); # On Zend PHP: NULL # On HHVM 3.15.4, 3.17.1: 'value'
You have javascript disabled. You will not be able to edit any code.