From:
Operating system: Debian Squeeze
PHP version: 5.3.8
Package: Class/Object related
Bug Type: Bug
Bug description:private Array
Description:
------------
Using an private array in a Class as Data Layer become readale outside of
class with print_r
Test script:
---------------
<?php
//test.php
require "classes/Item.class.php";
require "classes/User.class.php";
session_start();
//DB SHIT
$item = new Item(1);
echo "<pre>ITEMOBJECT:<br>".(print_r($item,true))."</pre>";
?>
<?php
// classes/Item.class.php
class Item {
private $DATA=array();
private $OWNER=null;
public function __construct($itemID) {
$item = mysql_fetch_assoc(mysql_query("SELECT * FROM w1_items WHERE
itemid = $itemID"));
$keys = array_keys($item);
foreach($keys as $key)
{
$this->DATA[$key] = $item[$key];
}
}
}
Expected result:
----------------
ITEMOBJECT:
Item Object
(
[DATA:Item:private] => Array
(
[itemid] => 1
[uid] => 2
)
[OWNER:Item:private] =>
)
--
Edit bug report at https://bugs.php.net/bug.php?id=60431&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=60431&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=60431&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=60431&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=60431&r=fixed
Fixed in SVN and need be documented:
https://bugs.php.net/fix.php?id=60431&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=60431&r=alreadyfixed
Need backtrace:
https://bugs.php.net/fix.php?id=60431&r=needtrace
Need Reproduce Script:
https://bugs.php.net/fix.php?id=60431&r=needscript
Try newer version:
https://bugs.php.net/fix.php?id=60431&r=oldversion
Not developer issue:
https://bugs.php.net/fix.php?id=60431&r=support
Expected behavior:
https://bugs.php.net/fix.php?id=60431&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=60431&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=60431&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=60431&r=globals
PHP 4 support discontinued:
https://bugs.php.net/fix.php?id=60431&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=60431&r=dst
IIS Stability:
https://bugs.php.net/fix.php?id=60431&r=isapi
Install GNU Sed:
https://bugs.php.net/fix.php?id=60431&r=gnused
Floating point limitations:
https://bugs.php.net/fix.php?id=60431&r=float
No Zend Extensions:
https://bugs.php.net/fix.php?id=60431&r=nozend
MySQL Configuration Error:
https://bugs.php.net/fix.php?id=60431&r=mysqlcfg