Warning: reset(): ....../cacti/lib/functions.php on line 146
Moderators: Developers, Moderators
Warning: reset(): ....../cacti/lib/functions.php on line 146
i used cacti0.8.7b and PA2
with no PA2,my cacti works ok,but after i patch the PA2,and i have changed the global.php,plugins.php and so on,there is a warning message to me:
Warning: reset(): Passed variable is not an array or object in /var/www/cacti/lib/functions.php on line 146
Warning: Variable passed to each() is not an array or object in /var/www/cacti/lib/functions.php on line 147
i searched in forums,but have no idea to solve it.i don't know what should i do!
about pa.sql,should i import it into cacti.sql,or replace the cacti.sql with pa.sql?
with no PA2,my cacti works ok,but after i patch the PA2,and i have changed the global.php,plugins.php and so on,there is a warning message to me:
Warning: reset(): Passed variable is not an array or object in /var/www/cacti/lib/functions.php on line 146
Warning: Variable passed to each() is not an array or object in /var/www/cacti/lib/functions.php on line 147
i searched in forums,but have no idea to solve it.i don't know what should i do!
about pa.sql,should i import it into cacti.sql,or replace the cacti.sql with pa.sql?
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
I saw a note related to this the other day. I asked the user to fill out a bug report at http://bugs.cacti.net. Check there, or google the reset() thingy. It had something to do with PHP versions and the user posted a fix.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
This would appear to be plugin related. I am experiencing it now. Superlinks was causing the issue. Don't know why as of yet.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
So far I have had this problem with only the latest plugin architecture installed (without any plugins). But for comparison to anyone else here are my plugins,
Code: Select all
$plugins = array();
$plugins[] = 'aggregate';
$plugins[] = 'reportit';
$plugins[] = 'monitor';
$plugins[] = 'settings';
$plugins[] = 'thold';
$plugins[] = 'tools';
$plugins[] = 'reports';
$plugins[] = 'killspike';
$plugins[] = 'weathermap';
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
The fix is as follows:
Edit lib/functions.php and change the code at or about line 125 to the code below:
This should solve the problem. Don't forget to backup you file first.
Regards,
TheWitenss
Edit lib/functions.php and change the code at or about line 125 to the code below:
Code: Select all
if (is_array($settings)) {
reset($settings);
while (list($tab_name, $tab_array) = each($settings)) {
if ((isset($tab_array[$config_name])) && (isset($tab_array[$config_name]["default"]))) {
return $tab_array[$config_name]["default"];
}else{
while (list($field_name, $field_array) = each($tab_array)) {
if ((isset($field_array["items"])) && (isset($field_array["items"][$config_name])) && (isset($field_array["items"][$config_name]["default"]))) {
return $field_array["items"][$config_name]["default"];
}
}
}
}
}
Regards,
TheWitenss
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
-
- Posts: 2
- Joined: Tue Mar 25, 2008 1:05 am
I upgraded from 8.6i to 8.7b and as well as the adodb.inc.php issue, I have encountered this reset() problem.
I applied the fix as suggested but it completely breaks cacti.
The error message I get instead is
Parse error: syntax error, unexpected $end in /usr/share/cacti/site/lib/functions.php on line 1942
I applied the fix as suggested but it completely breaks cacti.
The error message I get instead is
Parse error: syntax error, unexpected $end in /usr/share/cacti/site/lib/functions.php on line 1942
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Get the file back out of the original zip/tar and try again... that's usually a sign that you have missed a } somewhere.outbreakmonkey wrote:I upgraded from 8.6i to 8.7b and as well as the adodb.inc.php issue, I have encountered this reset() problem.
I applied the fix as suggested but it completely breaks cacti.
The error message I get instead is
Parse error: syntax error, unexpected $end in /usr/share/cacti/site/lib/functions.php on line 1942
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
- phalek
- Developer
- Posts: 2838
- Joined: Thu Jan 31, 2008 6:39 am
- Location: Kressbronn, Germany
- Contact:
Hi, I had the same issue and I actually found this related to the $user_auth_real_filenames and the $nav array.
you'll need to have the plugin file (e.g. nimd.php) configured in both arrays. If it's not present in the $nav array, the error you described occurs.
Example:
you'll need to have the plugin file (e.g. nimd.php) configured in both arrays. If it's not present in the $nav array, the error you described occurs.
Example:
Code: Select all
function nmid_config_arrays () {
...
$user_auth_realm_filenames['nmid.php'] = 1191;
...
}
function nmid_draw_navigation_text ($nav) {
...
$nav["nmid.php:"] = array("title" => "NMID", "mapping" => "index.php:", "url" => "nmid.php", "level" => "1");
...
}
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
I have asked Roman and Ian to publish this patch. Still waiting...
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
- Howie
- Cacti Guru User
- Posts: 5508
- Joined: Thu Sep 16, 2004 5:53 am
- Location: United Kingdom
- Contact:
Just so I understand, is this a patch to 'defend' against something bad that superlinks is doing, or is it actually an error in the way Cacti does it? I have never full understood how this particular part of Cacti works internally...
Weathermap 0.98a is out! & QuickTree 1.0. Superlinks is over there now (and built-in to Cacti 1.x).
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
Some Other Cacti tweaks, including strip-graphs, icons and snmp/netflow stuff.
(Let me know if you have UK DevOps or Network Ops opportunities, too!)
- TheWitness
- Developer
- Posts: 17062
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
Well, it depends on how you look at it What you are doing in superlinks is making a database connection out of order so that you can modify the various arrays. By doing so, you run into the uninitialized array, which is a bad practice on our part. Ian always warned, don't ever assume an array is initialized by doing something stupid like "reset()" prior to if (is_array(blah)).
So, by doing things out of order, you introduced a new failure mode. However, because I LOVE Superlinks SOOO much, I decided to fix our poor coding.
I think there is another fix, to connect to the database much sooner in the global.php initialization process, but that would require me to think. Since my brain is quite close to exploding, I took the shortcut.
Regards,
Larry
So, by doing things out of order, you introduced a new failure mode. However, because I LOVE Superlinks SOOO much, I decided to fix our poor coding.
I think there is another fix, to connect to the database much sooner in the global.php initialization process, but that would require me to think. Since my brain is quite close to exploding, I took the shortcut.
Regards,
Larry
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Who is online
Users browsing this forum: No registered users and 1 guest