Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

email_report.php script broken in 2.33.0 #882

Closed
jefft opened this issue Mar 14, 2023 · 4 comments
Closed

email_report.php script broken in 2.33.0 #882

jefft opened this issue Mar 14, 2023 · 4 comments

Comments

@jefft
Copy link
Contributor

jefft commented Mar 14, 2023

The scripts/email_report.php script appears broken. Given the config file:

; Edit the values below and save as another filename
; Then run   php email_report.php /path/to/my/config.ini
;
REPORT_ID=3;
;
EMAIL_FROM='reports@example.com';
;
EMAIL_FROM_NAME='Jethro';
;
;messages to appear above the report table in the email, use <br> for new line <b>for bold</b> etc.
MESSAGE='';
;
;send to one or more email addresses separated by a comma, and without spaces
;e.g. EMAIL_TO='email@address.com'; or EMAIL_TO='email@address.com,email2@address.com';
EMAIL_TO='me@example.com';

;Enter a GROUP_ID number to overide the EMAIL_TO addresses and send to a jethro group instead - otherwise leave next line as GROUP_ID=0;
GROUP_ID=0;
;
;if you would like the report attached as a .csv file then leave this next line as CSV=1;
;Otherwise change to CSV=0;
CSV=1;
;
;if your server can not email using Jethro-pmm built-in email script (swiftmailer) try using php mail() by changing the next line to PHP_MAIL=1; otherwise leave as PHP_MAIL=0;

VERBOSE=0;

The script generates a report with blank fields, and repeats the error:

Notice: Undefined offset: 3 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 154
PHP Notice:  Undefined offset: 1 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 154

In another example, the script prints a long series of errors:

PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566                                                                                                                                        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566                                                                                                                                        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566                                                                                                                                        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566                                                                                                                                        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566                                                                                                                                        
PHP Notice:  Undefined variable: heading in /home/jethro/code/2.33.0/app/db_objects/person_query.class.php on line 1566
....
PHP Notice:  Undefined offset: 8 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 110                                                                                                                                                          
                                                                                                                                                                                                                                                               
Notice: Undefined offset: 8 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 110                               
PHP Notice:  Undefined offset: 8 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 112                                                                                                                                                                                                                                                                                                                                                                                                                         
Notice: Undefined offset: 8 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 112                               
PHP Notice:  Undefined offset: 1 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 117                                                                                                                                                          
                                                                                                                               
Notice: Undefined offset: 1 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 117                               
PHP Notice:  Undefined offset: 2 in /home/jethro/code/2.33.0/app/scripts/email_report.php on line 117

and the generated report contains errors:
image

@tbar0970 tbar0970 added the bug label Mar 15, 2023
@tbar0970
Copy link
Owner

I suspect this is, somehow, hosting specific, because nothing has changed in that code recently.

@tbar0970
Copy link
Owner

Possibly some upstream changes have caused it

@tbar0970
Copy link
Owner

The upstream problem is that exporting a report as CSV exhibits that same (kind of) problem.
No recent changes to that code either. Suspect a php version factor.

@tbar0970
Copy link
Owner

Not a php version issue. There was in fact a line changed https://github.com/tbar0970/jethro-pmm/blame/master/db_objects/person_query.class.php#L1566 with a typo (wrong variable name due to copy and paste) :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants