-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
4.0.0-b1
-
None
The events added by PHPBB-17725, PHPBB-17726 and PHPBB-17727 pass
avatar_img to compact(), but on master that variable is never set:
- core.mcp_warn_user_modify_template_vars (includes/mcp/mcp_warn.php)
- core.mcp_warn_post_modify_template_vars (includes/mcp/mcp_warn.php)
- core.mcp_notes_user_modify_template_vars (includes/mcp/mcp_notes.php)
On 3.3.x, $avatar_img comes from phpbb_get_user_avatar(). Master replaced
that call with the avatar.helper service, which returns an array in
$avatar, so when 3.3.x was merged into master the events kept a variable
that no longer exists.
STEPS TO REPRODUCE
==================
1. On a master board with debug enabled, open the MCP and warn a user
(mcp.php?i=warn&mode=warn_user&u=<id>), warn a post, or view a user's
notes.
2. The page shows:
PHP Warning: compact(): Undefined variable $avatar_img
(includes/mcp/mcp_warn.php line 531 for the warn-user page)
EXPECTED RESULT
===============
No warning, and listeners receive the rendered avatar HTML in avatar_img,
as the event docblocks describe and as on 3.3.x.
ACTUAL RESULT
=============
A PHP warning on each of these pages, and avatar_img is missing from the
event data.
PROPOSED FIX
============
Before each of the three trigger_event() calls, set
$avatar_img = $avatar['html']; - the avatar helper's array always has an
html key. This keeps the event variables and their meaning the same on
3.3.x and master, so listeners work unchanged on both.
Found by the functional tests of an extension (phpbbmodders/ban-hammer)
that opens the MCP warn-user page on phpBB master.

