]> granicus.if.org Git - php/commitdiff
Adding test to stabelize keys used when converting objects to arrays
authorMarco Pivetta <ocramius@gmail.com>
Thu, 20 Jun 2013 08:17:32 +0000 (10:17 +0200)
committerStanislav Malyshev <stas@php.net>
Sun, 23 Jun 2013 20:53:37 +0000 (13:53 -0700)
tests/classes/array_conversion_keys.phpt [new file with mode: 0644]

diff --git a/tests/classes/array_conversion_keys.phpt b/tests/classes/array_conversion_keys.phpt
new file mode 100644 (file)
index 0000000..e3bd7e0
--- /dev/null
@@ -0,0 +1,18 @@
+--TEST--
+Verifies the correct conversion of objects to arrays
+--FILE--
+<?php
+class foo
+{
+       private $private = 'private';
+       protected $protected = 'protected';
+       public $public = 'public';
+}
+var_export((array) new foo);
+?>
+--EXPECTF--
+array (
+  '' . "\0" . 'foo' . "\0" . 'private' => 'private',
+  '' . "\0" . '*' . "\0" . 'protected' => 'protected',
+  'public' => 'public',
+)