Filter and event screens not working

Forum for questions and support relating to the 1.24.x releases only.
Locked
roikv
Posts: 2
Joined: Wed May 20, 2009 6:38 pm

Filter and event screens not working

Post by roikv »

I have a Zoneminder 1.24.1 installation on an Ubuntu 8.04 server with php 5.2.4.

Whenever I want to go to the filter window or when I click on the events in the main zoneminder screen I get following error.

For the events:
Fatal error: Cannot use string offset as an array in /var/www/includes/functions.php on line 1333

For the Filter window:
Fatal error: Cannot use string offset as an array in /var/www/skins/classic/views/filter.php on line 184

Does anyone have a clue why Zoneminder is giving this error? It worked perfectly when I installed it from source. It appears that zoneminder is recording events, I can only not view them.

Does anyone know how to fix this?

Thank You.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

Try this.
roikv
Posts: 2
Joined: Wed May 20, 2009 6:38 pm

Post by roikv »

cordel wrote:Try this.
Wow that REALLY helps me (not).... Do you really think I did not lookup that error on google???

The only thing I find when I search for this is the fact that there is an error in the php-code. My question was if anyone knows why ZM is giving me that error.

So if you think the answer is that easy to find, you are welcome to share it with me.

Thank you
overly
Posts: 36
Joined: Mon Aug 20, 2007 6:14 pm
Location: Cleveland, Ohio USA

Post by overly »

My events list wasn't showing any events either after upgrading to 1.24.2. From the Apache error log I found the following:

Code: Select all

... Unknown column 'LearnState' in 'field list'...
In zm_html_view_events.php the SQL is built using LearnState as one of the parameters.

However this comment from zm_update-1.23.3.sql indicates the column gets dropped from database during the upgrade to 1.24.X.

Code: Select all

--
-- Get rid of never used columnn Learn State
--
alter table Events drop column LearnState;
If I remeove LearnState from the SQL query my events list shows up properly.

Sounds like the LearnState field shouldn't have been dropped from the database without removing references to it in the code.

Note there are other places where LearnState is referenced in the code.
Bluecherry PV-149 4-port capture card
Topica TP-936WIR-30C camera
Cheap Harbor Freight camera
HP Athlon 64 X2 w/ 2GB
Slackware 13 - 2.6.29.6-smp kernel
overly
Posts: 36
Joined: Mon Aug 20, 2007 6:14 pm
Location: Cleveland, Ohio USA

Post by overly »

You can disregard my previous post. The problem I had was that when I upgraded from 1.23.3 to 1.24.2 all the original web interface files from 1.23.3 remained in the web directory. I renamed the existing web directory then did a make install to copy the 1.24.2 files over again. This cured the majority of problems I was having.
Bluecherry PV-149 4-port capture card
Topica TP-936WIR-30C camera
Cheap Harbor Freight camera
HP Athlon 64 X2 w/ 2GB
Slackware 13 - 2.6.29.6-smp kernel
dedmeet
Posts: 21
Joined: Sat Sep 08, 2007 9:38 pm
Location: Australia

non array in functions on line 1333

Post by dedmeet »

Hi,

Installed zoneminder 1.24.1 (ubuntu karmic server), and all goes well, except for the same error on the events window, however mine has an additional oddity : It does not happen on my laptop.

Very weird, as all the machines are all the same install of ubuntu, and that should (??) not be a worry anyways, as the pages are served from the server, so if it is working for one, it *should* work on the other machines.

I had a quick look at the code, and the function in question ' parseFilter' is supposed to be passed an array ($filter), but for some reason the var is populated with a string when the other machines call the page. The value at that time is simply 'all'.

So, somewhere this function is called with the wrong value (not an array)

A simple fix (as I do not have time to hunt down the where) is to test if $filter is not an array, and if not - re-init it to an array.

So I placed the following at line 1325:

if (!is_array($filter)){
$filter=array();
}

just above the line where the 'supposed to be an array' is adjusted. $filter['query'] = '';

It now works on all machines.

Diff below:

1325,1328d1324
< if (!is_array($filter)){
< $filter=array();
< }
<
braindead0
Posts: 10
Joined: Mon Nov 30, 2009 9:08 pm

Post by braindead0 »

Clear out your cookies, I just had this happen and figured it had to be something on the browser side as nothing changed on the ZM server.

Fixed the problem for me.
braindead0
Posts: 10
Joined: Mon Nov 30, 2009 9:08 pm

Post by braindead0 »

Found the root cause of the problem for me, I'm using Transmission web interface on that same server. It sets a cookie named 'filter', which interferes with the ZM &filter url parameter.

I worked around this problem by adding

setcookie('filter', '', time() - (3600 * 25), '/', '', 0);

in index.php, right after the session_start(); call.

That works around the problem with minimum hassle.
Locked