|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-07-15 09:42 UTC] helly@php.net
[2006-07-15 10:20 UTC] public at grik dot net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 21:00:01 2025 UTC |
Description: ------------ When I declare a property as "public", it's being ignored. When I declare it as protected or private it is processed and visible from outside of the object. Reproduce code: --------------- A) class Rules extends ArrayObject { public $len; function __construct($array){ parent::__construct($array,2); $this['len'] = 2; } } $x = new Rules(array(1,2)); var_dump($x->len); B) class Rules extends ArrayObject { protected $len; function __construct($array){ parent::__construct($array,2); $this['len'] = 2; } } $x = new Rules(array(1,2)); var_dump($x->len); Expected result: ---------------- A) int(2) B) Fatal error</b>: Cannot access protected property Rules::$len Actual result: -------------- A) NULL B) int(2)