PDA

View Full Version : Fatal Error in History Modul for v2.0


jagy
02-04-05, 04:14 PM
After updating to v2.0 I am getting the following error:
Fatal error: Call to a member function on a non-object in /home/rc/public_html/dotproject/modules/history/index.php on line 116

Any recomendations to fix this problem

ajdonnison
02-04-05, 04:42 PM
This exact error was reported earlier today, and it occurred with PHP5. That other post had a link to a bug report on php.net. If you are using PHP5, check that first (try searching the forums for the error message string).

alphaone
05-04-05, 07:54 AM
I receive the same error...

I use PHP 4.3.11...

Any Issues?

Thanks :wink:

ajdonnison
05-04-05, 08:40 AM
Is this exactly the same error or just a similar error? In other words is the error in the history module, index.php line 116?

pedroa
05-04-05, 08:42 AM
Yes it is.

pedroa
05-04-05, 11:19 AM
Here is what I found out:

1) Line 16 is wrong it says:

<form name="filter" action="?m=history" method="post" onChange="document.filter.submit();>

Noticed the onChange event, shouldn't be here but on line 18 instead, because it is when you select an option from the select box that something should happen.
So line 18 changes to:

<select name="filter" onChange="document.filter.submit();">

and line 16 changes to:

<form name="filter" action="?m=history" method="post">


2) Now comes the tricky part, problem resides in the $q variable and the DBQuery class.
To resolve things, it was enough to just add on line 115 the following:
$q = new DBQuery;

But this would make you see all history itens, and would not filter according to your selection.
Now, if you change line 91 from:

$filter = ' AND history_table = \'' . $_REQUEST['filter'] . '\' ';

to:

$filter = '\'' . $_REQUEST['filter'] . '\' ';

and change line 118:

$q->addWhere('history_user = user_id'.$filter);

into:

$q->addWhere('history_user = user_id');
if (!empty($_REQUEST['filter']))
$q->addWhere('history_table = '.$filter);

you will get your filtering working.

3) I have noticed that all history dates get zeroed by default, so not worring too much i just commented line 21 on addedit.php for manual loging. and changed the history_date's field, from table history, from DATETIME to TIMESTAMP and it's default to nothing (that means it changes to CURRENT_TIMESTAMP).
Change line 36 of setup.php to:

"history_date TIMESTAMP NOT NULL," .

Now comment line 294 on includes/main_functions.php and every automatic log will be ok.

4) In projects history is still messed up, but for starters some steps were taken.

5) I added a line after line 21 for the tasks:

<option value="tasks">Tasks</option>
Because i liked it, you might like it too.

Hope these helps,

Pedro A.

alphaone
05-04-05, 03:59 PM
Thank's pedroa!

I'm gonna try your corrections!

:D

Bye

jagy
06-04-05, 12:13 AM
Pedroa solution works !
Thank you!
Jagy

Col
08-04-05, 04:55 PM
The date time is in the long format

'20050408074356' any ideas on how to make it a little more user friendly?

Thanks

suttree
08-04-05, 06:51 PM
Format the MySQL timestamp as a Unix timestamp just after the "foreach($history as $row)" line (around line 142).


// Tidy the history date, code from Aidan,
// http://aidan.dotgeek.org/lib/?file=function.convert_timestamp.php
$parts = sscanf($row[ 'history_date' ],'%04u%02u%02u%02u%02u%02u');
$history_date = vsprintf('%04u-%02u-%02u %02u:%02u:%02u', $parts);


Then, instead of "echo $row["history_date"]" do this:


echo date( "Y-m-d", strtotime($history_date));

Col
09-04-05, 07:35 AM
Format the MySQL timestamp as a Unix timestamp just after the "foreach($history as $row)" line (around line 142).

[code]
// Tidy the history date, code from Aidan,
// http://aidan.dotgeek.org/lib/?file=function.convert_timestamp.php
$parts = sscanf($row



Hey Suttree

Thanks for that. And such a quick response too. Next time I'm in London, let me buy you a beer, lol. :D

ajdonnison
09-04-05, 10:08 AM
Thanks Pedroa and others, some of your suggestions will make it into the 2.0.1 release that should go out within the next 24 hours.

pedroa
10-04-05, 04:09 AM
Hi, ajdonnison

I hope you have seen http://www.dotproject.net/index.php?name=PNphpBB2&file=viewtopic&t=2315 also,
my solution is based on a datatype that might not work with older mysql servers.

I understand that you are a forum crawler just like me, but that might escaped you so before 2.0.1 it comes out, i felt like warning you. We wouldn't want more posts here because of that, wouldn't we?

I am always glad to help, by the way...

Pedro A.

mrpresley
17-04-05, 11:47 PM
In 2.01, the history module now returns an error on line 122 in index.php... Its an easy fix though.. The closing parenthesis was left out on that line of code.

MrPresley

rlewis@dtims.com
03-06-05, 04:44 AM
quick questions:

I got everything else to work until this point and I don't understand what this comment means:

Does it mean to just comment it out?

"3) I have noticed that all history dates get zeroed by default, so not worring too much i just commented line 21 on addedit.php for manual loging. "

I also noticed it takes a bit of time to display all the history messages. Has anyone else noticed that behavior?

servisis
05-12-05, 11:28 AM
I am sure you managed to work it out, but for anyone else reading this (as I just did) the way to comment out code in php is to add two slashes at the start of the line, like so:

// this line is commented and will not be executed by the program

this line will be read as code

Grateful thanks to all for the solutions posted here, my quickest ever bug fix in php. :)