6.0.0-alpha10
5/14/25

[#15093] Logfile clogged with PHP error messages when using PHP 7.4
Summary Logfile clogged with PHP error messages when using PHP 7.4
Queue Horde Framework Packages
Type Bug
State Unconfirmed
Priority 2. Medium
Owners
Requester wahnes (at) uni-koeln (dot) de
Created 02/02/2022 (1197 days ago)
Due
Updated 02/02/2022 (1197 days ago)
Assigned
Resolved
Milestone
Patch Yes

History
02/02/2022 03:37:29 PM wahnes (at) uni-koeln (dot) de Comment #1
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Type ⇒ Bug
Summary ⇒ Logfile clogged with PHP error messages when using PHP 7.4
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ Yes
New Attachment: horde-theme.patch Download
Reply to this comment
When using the current Horde 5 packages with PHP 7.4, a lot messages 
are sent to the log files regarding the use of array indexes with NULL 
values. With PHP 7.4, this kind of access pattern causes these notices 
to generated, which was not the case with earlier PHP versions. While 
it's possible to adjust the Horde log level in order to get rid of 
these messages, I'd prefer if this could be resolved in the code base, 
at least for the majority of cases.

One of the most prominent examples is in Horde/Themes (part of the 
Horde_Core package). As this is called very often, it generates a lot 
of noise in the log files. Here's an example of a message typically 
logged several times per second:

HORDE[421302]: [horde] PHP ERROR: Trying to access array offset on 
value of type null [pid 421302 on line 146 of 
"/usr/share/pear/Horde/Themes/Element.php"]

This can easily be resolved by checking the value using "isset". 
Attached is a simple patch for the above case of Horde/Themes.

Other common cases that show up in the log files quite often are these two:

PHP ERROR: Trying to access array offset on value of type null [pid 
421302 on line 396 of "[...]/kronolith/lib/CalendarsManager.php"
PHP ERROR: Trying to access array offset on value of type null [pid 
421302 on line 668 of "[...]/imp/lib/Contents.php"

These latter ones affect Kronolith and Imp. I guess I could write 
patches for these, too. I'm just not sure if applying my patches would 
be even more troublesome for you than fixing this yourself. Maybe 
you're not even convinced this needs fixing at all? Please let me know 
what you prefer (create two new bug tickets in the respective queues, 
provide patches there, or add them here) and I'll provide patches for 
these additional instances or not.

Saved Queries