From b7bac968eef945322d1e28d7e833b6a549a6da27 Mon Sep 17 00:00:00 2001 From: ludo444 Date: Thu, 12 Dec 2019 22:06:31 +0200 Subject: [PATCH] Test that AccessInterceptorScope doesn't throw Serialized class Erroneous data PHP warning --- ...rialized-class-private-property-isset.phpt | 30 +++++++++++++++++++ ...erialized-class-private-property-read.phpt | 30 +++++++++++++++++++ ...rialized-class-private-property-unset.phpt | 30 +++++++++++++++++++ ...rialized-class-private-property-write.phpt | 30 +++++++++++++++++++ ...alized-class-protected-property-isset.phpt | 30 +++++++++++++++++++ ...ialized-class-protected-property-read.phpt | 30 +++++++++++++++++++ ...alized-class-protected-property-unset.phpt | 30 +++++++++++++++++++ ...alized-class-protected-property-write.phpt | 30 +++++++++++++++++++ 8 files changed, 240 insertions(+) create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-isset.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-read.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-unset.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-write.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-isset.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-read.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-unset.phpt create mode 100644 tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-write.phpt diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-isset.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-isset.phpt new file mode 100644 index 000000000..ba96c21f6 --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-isset.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct isset check +--FILE-- +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) diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-read.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-read.phpt new file mode 100644 index 000000000..8ea6c9f59 --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-read.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct read +--FILE-- +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 diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-unset.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-unset.phpt new file mode 100644 index 000000000..8856ffeab --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-unset.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct unset +--FILE-- +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 diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-write.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-write.phpt new file mode 100644 index 000000000..5dd51e159 --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-private-property-write.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class private property direct write +--FILE-- +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 diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-isset.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-isset.phpt new file mode 100644 index 000000000..6515d8d1c --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-isset.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct isset check +--FILE-- +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) diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-read.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-read.phpt new file mode 100644 index 000000000..6b94af19a --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-read.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct read +--FILE-- +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 diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-unset.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-unset.phpt new file mode 100644 index 000000000..3a41811bc --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-unset.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct unset +--FILE-- +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 diff --git a/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-write.phpt b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-write.phpt new file mode 100644 index 000000000..801015526 --- /dev/null +++ b/tests/language-feature-scripts/access-interceptor-scope-localizer-serialized-class-protected-property-write.phpt @@ -0,0 +1,30 @@ +--TEST-- +Verifies that generated access interceptors doesn't throw PHP Warning on Serialized class protected property direct write +--FILE-- +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