#46251 [NEW]: Array type documentation, error in example

From: Date: Tue, 07 Oct 2008 23:45:51 +0000
Subject: #46251 [NEW]: Array type documentation, error in example
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1190@lists.php.net to get a copy of this message
From: php at pengi dot se Operating system: PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Array type documentation, error in example Description: ------------ First example under section Examples in documentation for Array type says, that creating an array with array(initial value) is the same as writing: $a[key] = value; $a[key] = value; $a[key] = value; but missing initialization of the variable. This may also be a security issue for people using this way of initialization and also are using register_globals. What should be added to the example is: $a = array(); URL to related documentation page: http://php.net/manual/en/language.types.array.php Reproduce code: --------------- // this $a = array( 'color' => 'red', 'taste' => 'sweet', 'shape' => 'round', 'name' => 'apple', 4 // key will be 0 ); // is completely equivalent with $a['color'] = 'red'; $a['taste'] = 'sweet'; $a['shape'] = 'round'; $a['name'] = 'apple'; $a[] = 4; // key will be 0 -- Edit bug report at http://bugs.php.net/?id=46251&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=46251&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=46251&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=46251&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=46251&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=46251&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=46251&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=46251&r=needscript Try newer version: http://bugs.php.net/fix.php?id=46251&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=46251&r=support Expected behavior: http://bugs.php.net/fix.php?id=46251&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=46251&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=46251&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=46251&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46251&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=46251&r=dst IIS Stability: http://bugs.php.net/fix.php?id=46251&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=46251&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=46251&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=46251&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=46251&r=mysqlcfg

« previous php.doc.bugs (#1190) next »