-
-
Notifications
You must be signed in to change notification settings - Fork 188
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test that AccessInterceptorScope doesn't throw Serialized class Erron…
…eous data PHP warning
- Loading branch information
Showing
8 changed files
with
240 additions
and
0 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...e-scripts/access-interceptor-scope-localizer-serialized-class-private-property-isset.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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) |
30 changes: 30 additions & 0 deletions
30
...re-scripts/access-interceptor-scope-localizer-serialized-class-private-property-read.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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 |
30 changes: 30 additions & 0 deletions
30
...e-scripts/access-interceptor-scope-localizer-serialized-class-private-property-unset.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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 |
30 changes: 30 additions & 0 deletions
30
...e-scripts/access-interceptor-scope-localizer-serialized-class-private-property-write.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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 |
30 changes: 30 additions & 0 deletions
30
...scripts/access-interceptor-scope-localizer-serialized-class-protected-property-isset.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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) |
30 changes: 30 additions & 0 deletions
30
...-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-read.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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 |
30 changes: 30 additions & 0 deletions
30
...scripts/access-interceptor-scope-localizer-serialized-class-protected-property-unset.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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 |
30 changes: 30 additions & 0 deletions
30
...scripts/access-interceptor-scope-localizer-serialized-class-protected-property-write.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--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 |