summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/classes/unset_properties.phpt154
-rw-r--r--tests/lang/034.phpt4
-rw-r--r--tests/lang/bug30638.phpt4
-rw-r--r--tests/output/ob_017.phpt4
-rw-r--r--tests/security/open_basedir_001.phpt3
5 files changed, 167 insertions, 2 deletions
diff --git a/tests/classes/unset_properties.phpt b/tests/classes/unset_properties.phpt
new file mode 100644
index 000000000..7f9b56988
--- /dev/null
+++ b/tests/classes/unset_properties.phpt
@@ -0,0 +1,154 @@
+--TEST--
+Un-setting instance properties causes magic methods to be called when trying to access them from outside the magic
+methods themselves.
+--FILE--
+<?php
+
+class Test
+{
+ public $publicProperty = 'publicProperty set';
+
+ protected $protectedProperty = 'protectedProperty set';
+
+ private $privateProperty = 'privateProperty set';
+
+ public function __get($name)
+ {
+ return '__get "' . $name . '"';
+ }
+
+ public function __set($name, $value)
+ {
+ $this->$name = $value;
+ echo '__set "' . $name . '" to "' . $value . '"';
+ }
+
+ public function __isset($name)
+ {
+ echo '__isset "' . $name . '"';
+ return isset($this->$name);
+ }
+
+ public function getPublicProperty()
+ {
+ return $this->publicProperty;
+ }
+
+ public function setPublicProperty($publicProperty)
+ {
+ $this->publicProperty = $publicProperty;
+ }
+
+ public function unsetProtectedProperty()
+ {
+ unset($this->protectedProperty);
+ }
+
+ public function getProtectedProperty()
+ {
+ return $this->protectedProperty;
+ }
+
+ public function setProtectedProperty($protectedProperty)
+ {
+ $this->protectedProperty = $protectedProperty;
+ }
+
+ public function unsetPrivateProperty()
+ {
+ unset($this->privateProperty);
+ }
+
+ public function getPrivateProperty()
+ {
+ return $this->privateProperty;
+ }
+
+ public function setPrivateProperty($privateProperty)
+ {
+ $this->privateProperty = $privateProperty;
+ }
+}
+
+// verifying public property
+$o = new Test;
+echo $o->publicProperty;
+echo "\n";
+var_export(isset($o->publicProperty));
+echo "\n";
+unset($o->publicProperty);
+isset($o->publicProperty);
+echo "\n";
+echo $o->publicProperty;
+echo "\n";
+echo $o->getPublicProperty();
+echo "\n";
+echo $o->setPublicProperty('new publicProperty value via setter');
+echo "\n";
+echo $o->publicProperty;
+echo "\n";
+unset($o->publicProperty);
+$o->publicProperty = 'new publicProperty value via public access';
+echo "\n";
+var_export(isset($o->publicProperty));
+echo "\n";
+echo $o->publicProperty;
+echo "\n\n";
+
+// verifying protected property
+echo $o->getProtectedProperty();
+echo "\n";
+$o->unsetProtectedProperty();
+var_export(isset($o->protectedProperty));
+echo "\n";
+echo $o->getProtectedProperty();
+echo "\n";
+echo $o->setProtectedProperty('new protectedProperty value via setter');
+echo "\n";
+var_export(isset($o->protectedProperty));
+echo "\n";
+echo $o->getProtectedProperty();
+echo "\n\n";
+
+// verifying private property
+echo $o->getPrivateProperty();
+echo "\n";
+$o->unsetPrivateProperty();
+var_export(isset($o->privateProperty));
+echo "\n";
+echo $o->getPrivateProperty();
+echo "\n";
+echo $o->setPrivateProperty('new privateProperty value via setter');
+echo "\n";
+var_export(isset($o->privateProperty));
+echo "\n";
+echo $o->getPrivateProperty();
+echo "\n\n";
+
+?>
+
+--EXPECTF--
+publicProperty set
+true
+__isset "publicProperty"
+__get "publicProperty"
+__get "publicProperty"
+__set "publicProperty" to "new publicProperty value via setter"
+new publicProperty value via setter
+__set "publicProperty" to "new publicProperty value via public access"
+true
+new publicProperty value via public access
+
+protectedProperty set
+__isset "protectedProperty"__isset "protectedProperty"false
+__get "protectedProperty"
+__set "protectedProperty" to "new protectedProperty value via setter"
+__isset "protectedProperty"true
+new protectedProperty value via setter
+
+privateProperty set
+__isset "privateProperty"__isset "privateProperty"false
+__get "privateProperty"
+__set "privateProperty" to "new privateProperty value via setter"
+__isset "privateProperty"true
+new privateProperty value via setter \ No newline at end of file
diff --git a/tests/lang/034.phpt b/tests/lang/034.phpt
index 5d2c61092..cea0797d6 100644
--- a/tests/lang/034.phpt
+++ b/tests/lang/034.phpt
@@ -4,6 +4,10 @@ Bug #12647 (Locale settings affecting float parsing)
precision=14
--SKIPIF--
<?php # try to activate a german locale
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ /* skip on windows until #63688 was fixed */
+ die('skip');
+}
if (setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1") === FALSE) {
print "skip Can't find german locale";
}
diff --git a/tests/lang/bug30638.phpt b/tests/lang/bug30638.phpt
index 30b70f30f..945a228ed 100644
--- a/tests/lang/bug30638.phpt
+++ b/tests/lang/bug30638.phpt
@@ -2,6 +2,10 @@
Bug #30638 (localeconv returns wrong LC_NUMERIC settings) (ok to fail on MacOS X)
--SKIPIF--
<?php # try to activate a german locale
+if (substr(PHP_OS, 0, 3) == 'WIN') {
+ /* skip on windows until #63688 was fixed */
+ die('skip');
+}
if (setlocale(LC_NUMERIC, "de_DE.UTF-8", "de_DE", "de", "german", "ge", "de_DE.ISO-8859-1") === FALSE) {
print "skip setlocale() failed";
} elseif (strtolower(php_uname('s')) == 'darwin') {
diff --git a/tests/output/ob_017.phpt b/tests/output/ob_017.phpt
index 070df603f..517fafe99 100644
--- a/tests/output/ob_017.phpt
+++ b/tests/output/ob_017.phpt
@@ -27,8 +27,8 @@ Array
[0] => 1: yes
[1] => 4: !
- [2] => 2:
+ [2] => 2: no
[3] => 0: yes!
- [4] => 10:
+ [4] => 10: no
)
diff --git a/tests/security/open_basedir_001.phpt b/tests/security/open_basedir_001.phpt
index e05861a81..9ea955994 100644
--- a/tests/security/open_basedir_001.phpt
+++ b/tests/security/open_basedir_001.phpt
@@ -5,6 +5,9 @@ openbase_dir runtime tightning
if (substr(PHP_OS, 0, 3) == 'WIN') {
die('skip.. only for unix');
}
+if (!is_dir("/usr/local/bin")) {
+ die('skip.. no /usr/local/bin on this machine');
+}
--INI--
open_basedir=/usr/local
--FILE--