techsneeze / dmarcts-report-viewer

DMARC Report Tool for use with rddmarc or dmarcts-report-parser (formerly imap-dmarcts)
http://www.techsneeze.com/dmarc-report/
GNU General Public License v3.0
195 stars 56 forks source link

Fatal error: Uncaught TypeError: setcookie() #69

Closed muety closed 3 years ago

muety commented 3 years ago

I'm getting this error when trying to open the viewer.

Fatal error: Uncaught TypeError: setcookie(): Argument #3 ($expires_or_options) must be of type array|int, string given in /var/www/storage/dmarc/dmarcts-report-viewer.php:222 Stack trace: #0 /var/www/storage/dmarc/dmarcts-report-viewer.php(222): setcookie() #1 {main} thrown in /var/www/storage/dmarc/dmarcts-report-viewer.php on line 222

I'm on PHP 8.0 with FPM.

jnew-gh commented 3 years ago

Ugh, getting javascript and PHP mixed up. :-)

Should be fixed in commit d81bfdd. Please test and report back.

muety commented 3 years ago

Thanks for the quick reaction. The above error seems to be fixed now, but there are new ones now:

Warning: Undefined variable $domains in /var/www/storage/dmarc/dmarcts-report-viewer.php on line 303

Warning: Undefined variable $orgs in /var/www/storage/dmarc/dmarcts-report-viewer.php on line 304

Warning: Undefined variable $periods in /var/www/storage/dmarc/dmarcts-report-viewer.php on line 305

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in /var/www/storage/dmarc/dmarcts-report-viewer.php:113 Stack trace: #0 /var/www/storage/dmarc/dmarcts-report-viewer.php(305): html() #1 {main} thrown in /var/www/storage/dmarc/dmarcts-report-viewer.php on line 113
jnew-gh commented 3 years ago

@muety, no problem.

The error seems to say that $periods is null which says to me that the SQL for that returns 0 rows, so there might be something going on with the database.

How many records do you have in your database? Is this a new install or have you used previous versions of dmarcts successfully?

muety commented 3 years ago

Never mind, the database was indeed empty. Everything's working now. Thanks for your help!

jnew-gh commented 3 years ago

Well, we helped each other!

Actually, testing dmarcts-viewer on an empty database is in my list of things to do, so I'd like to know what you mean by "empty": do you mean a database with no tables, or a database with tables but no records?

I know the former is the database state after you've created the database but haven't yet run dmarcts-parser for the first time. I thought that threw SQL errors from dmarcts-viewer.

However, I don't know (I guess I can test, too) if you can run the parser without a report present and end up with the database structure (i.e. tables with columns) but with no data.

muety commented 3 years ago

Yes, so if I recall correctly, what I did was run the parser without any records being present on IMAP. The tables got created properly, but remained empty. Maybe it would be cool to have a placeholder message telling the user like "no data found" or so.

jnew-gh commented 3 years ago

Thanks, that's good to know.

I hadn't realized the parser would create the tables without records, so I agree that the viewer should take this into account. It's now on my to do list.