Skip to content
Snippets Groups Projects
Commit b7bac968 authored by ludo444's avatar ludo444 Committed by Marco Pivetta
Browse files

Test that AccessInterceptorScope doesn't throw Serialized class Erroneous data PHP warning

parent bcec33ba
No related branches found
No related tags found
No related merge requests found
Showing
with 240 additions and 0 deletions
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct isset check
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
private $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
var_dump(isset($proxy->sweets));
?>
--EXPECT--
bool(false)
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct read
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
private $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
$proxy->sweets;
?>
--EXPECTF--
%SFatal error:%sCannot access private property %s::$sweets in %a
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct unset
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
private $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
unset($proxy->sweets);
?>
--EXPECTF--
%SFatal error:%sCannot %s property%sin %a
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct write
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
private $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
$proxy->sweets = 'stolen';
?>
--EXPECTF--
%SFatal error:%sCannot %s property%sin %a
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct isset check
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
protected $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
var_dump(isset($proxy->sweets));
?>
--EXPECT--
bool(false)
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct read
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
protected $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
$proxy->sweets;
?>
--EXPECTF--
%SFatal error:%sCannot access protected property %s::$sweets in %a
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct unset
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
protected $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
unset($proxy->sweets);
?>
--EXPECTF--
%SFatal error:%sCannot %s property%sin %a
--TEST--
Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct write
--FILE--
<?php
require_once __DIR__ . '/init.php';
class Kitchen implements \Serializable
{
protected $sweets = 'candy';
function serialize()
{
return $this->sweets;
}
function unserialize($serialized)
{
$this->sweets = $serialized;
}
}
$factory = new \ProxyManager\Factory\AccessInterceptorScopeLocalizerFactory($configuration);
$proxy = $factory->createProxy(new Kitchen());
$proxy->sweets = 'stolen';
?>
--EXPECTF--
%SFatal error:%sCannot %s property%sin %a
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment