php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #34345 Extend ArrayObject::setFlags functionality
Submitted: 2005-09-02 13:25 UTC Modified: 2005-09-02 22:28 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: stochnagara at hotmail dot com Assigned: helly (profile)
Status: Wont fix Package: Feature/Change Request
PHP Version: 5CVS-2005-09-02 (snap) OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: stochnagara at hotmail dot com
New email:
PHP Version: OS:

 

 [2005-09-02 13:25 UTC] stochnagara at hotmail dot com
Description:
------------
ArrayObject has a method called setFlags. This method is still not documented (set bug #34101). Anyway, I found out what is its possible purpose - if the passed parameter is an even number then ArrayObject's internal array values are printed in var_dump and if the passed parameter is an odd number then object properties of the class which extends ArrayObject are show. (See also bug #33799).

But I suggest setFlags fills another gap: set possible values to be 0, 1 or 2. 0 and 1 keep old functionality and 2 allows var_dump to print both internal array values and properties of the class.

Reproduce code:
---------------
<?
class dummy extends ArrayObject {
	public $var;
	function __construct() {
		$this->var = 'override';
		$this['internal'] = 'base';
	}
}

$foo = new dummy();
for ($i = 0; $i < 3; $i++) {
	$foo->setFlags ($i);
	var_dump($foo);
}


Expected result:
----------------
object(dummy)#1 (1) {
  ["internal"]=>
  string(4) "base"
}
object(dummy)#1 (1) {
  ["var"]=>
  string(8) "override"
}
object(dummy)#1 (2) {
  ["internal"]=>
  string(4) "base",
  ["var"]=>
  string(8) "override"
}


Actual result:
--------------
object(dummy)#1 (1) {
  ["internal"]=>
  string(4) "base"
}
object(dummy)#1 (1) {
  ["var"]=>
  string(8) "override"
}
object(dummy)#1 (1) {
  ["internal"]=>
  string(4) "base"
}


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-02 22:00 UTC] helly@php.net
The documentaion is updated here:
http://php.net/~helly
 [2005-09-02 22:28 UTC] helly@php.net
Reading it again i must say that it is not possible to fill your gap.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 05:01:33 2025 UTC