For Programmers: Free Programming Magazines  


Home > Archive > PHP Documentation > September 2006 > cvs: phpdoc /en/language types.xml









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author cvs: phpdoc /en/language types.xml
Joey Smith

2006-09-25, 9:58 pm

joey Tue Sep 26 00:37:57 2006 UTC

Modified files:
/phpdoc/en/language types.xml
Log:
Fix #38935, document changes in PHP5 when casting objects to arrays.


http://cvs.php.net/viewvc.cgi/phpdo...8&diff_format=u
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.167 phpdoc/en/language/types.xml:1.168
--- phpdoc/en/language/types.xml:1.167 Thu Aug 31 01:57:26 2006
+++ phpdoc/en/language/types.xml Tue Sep 26 00:37:57 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.167 $ -->
+<!-- $Revision: 1.168 $ -->
<chapter id="language.types">
<title>Types</title>

@@ -1820,7 +1820,33 @@
<para>
If you convert an <type>object</type> to an array, you get the
properties (member variables) of that object as the array's elements.
- The keys are the member variable names.
+ The keys are the member variable names with a few notable exceptions:
+ private variables have the class name prepended to the variable name;
+ protected variables have a '*' prepended to the variable name.
+ These prepended values have null bytes on either side. This can result
+ in some unexpected behaviour.
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+class A {
+ private $A; // This will become '\0A\0A'
+}
+
+class B extends A {
+ private $A; // This will become '\0B\0A'
+ public $AA; // This will become 'AA'
+}
+
+var_dump((array) new B());
+?>
+]]>
+ </programlisting>
+ </informalexample>
+
+ The above will appear to have two keys named 'AA', although one
+ of them is actually named '\0A\0A'.
</para>

<para>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com