|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65756 RRDGraph->setOptions wont accept multiple --color options
Submitted: 2013-09-24 22:06 UTC Modified: 2014-01-13 22:36 UTC
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: shaun dot reitan at ndchost dot com Assigned: koubel (profile)
Status: Closed Package: rrd (PECL)
PHP Version: Irrelevant OS: Linux/CentOS/RHEL
Private report: No CVE-ID: None
 [2013-09-24 22:06 UTC] shaun dot reitan at ndchost dot com
For obvious reasons the setOptions() method of RRDGraph doesnt seam to accept multiple --color switches.  Since an array is passed this makes sense being that you cant have multiple keys with the same name.  I tried to not use the key => value method and pass mutliples using array( '--color BACK#00000000', '--color GRID#00000000', ...); but that doesnt appear to work either.

Not really sure what the option is to resolve this...

Test script:
$rrdgraph = new RRDGraph("-");
$rrdgraph->setOptions( array(
   '--color' => 'BACK#00000000',
   '--color' => 'GRID#00000000',
   '--color' => 'MGRID#00000000',
$rrddata = $rrdgraph->saveVerbose();


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-28 21:28 UTC] bryandamage at gmail dot com
i've been able to get multiple color switch using this format.

$rrdgraph = new RRDGraph("-");
$rrdgraph->setOptions( array(
$rrddata = $rrdgraph->saveVerbose();
 [2013-09-28 21:36 UTC] shaun dot reitan at ndchost dot com

I just figured it out the other day that I could simply do the following.  

array('--color', 'BACK#00000000', '--color', 'GRID#00000000', ...);

As much as i liked using a key/value pair for easy reading, I decided to just 
stick with each option being an array value like above.

Also, maybe we should update the php docs to show an example of this?
 [2013-10-01 08:15 UTC]
-Status: Open +Status: Assigned -Type: Bug +Type: Documentation Problem -Assigned To: +Assigned To: koubel
 [2013-10-01 08:15 UTC]
You declare array with same key multiple times, hence your argument for the setOption call like:

   '--color' => 'BACK#00000000',
   '--color' => 'GRID#00000000',
   '--color' => 'MGRID#00000000',

is in fact only:

   '--color' => 'MGRID#00000000'

this is the nature of php arrays.

Solution is suggested by Brian. I agree with the better docs, but I need to find the repo with the php-docs, it takes some time, it's little bit complicated for me modifying the php-docs one per many years.
 [2014-01-13 22:31 UTC]
Automatic comment from SVN on behalf of koubel
Log: rrd: more examples for RRDGraph::setOptions #65756
 [2014-01-13 22:33 UTC]
-Status: Assigned +Status: Closed
 [2014-01-13 22:33 UTC]
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at

 For Windows:
Thank you for the report, and for helping us make PHP better.

 [2014-01-13 22:36 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Sep 28 05:03:38 2021 UTC