Skip to content

Fix GH-80: Trim whitespace in tag content before link resolution#237

Open
lacatoire wants to merge 3 commits intophp:masterfrom
lacatoire:fix/gh-80-whitespace-in-tag-names
Open

Fix GH-80: Trim whitespace in tag content before link resolution#237
lacatoire wants to merge 3 commits intophp:masterfrom
lacatoire:fix/gh-80-whitespace-in-tag-names

Conversation

@lacatoire
Copy link
Contributor

Summary

  • Adds trim() to all text handler functions that resolve links (format_function_text, format_varname_text, format_classname_text, format_type_text, format_enumidentifier_text, and classsynopsis variants) in both PHP and PEAR XHTML packages
  • When <function>, <methodname>, <classname>, <varname>, <type>, or <enumidentifier> tags contain leading/trailing whitespace (e.g. from line breaks in translated documentation), link resolution was failing because the lookup key included the whitespace
  • Adds a test covering <function>, <methodname>, <classname>, and <varname> tags with whitespace

Fixes #80

When <function>, <methodname>, <classname>, <varname>, <type>, or
<enumidentifier> tags contain leading/trailing whitespace (e.g. from
line breaks in translated documentation), link resolution fails because
the lookup key includes the whitespace.

Add trim() to all text handler functions that resolve links, ensuring
whitespace does not break cross-reference linking.
lacatoire and others added 2 commits February 15, 2026 21:47
Co-authored-by: Gina Peter Banyard <girgias@php.net>
… fix varname CSS class

- Add static Format::trimValue() that trims whitespace and emits
  E_USER_WARNING when whitespace is found in tag content
- Replace all bare trim() calls with Format::trimValue() in PHP and
  PEAR XHTML formatters
- Fix class="classname" to class="varname" in format_varname_text link
- Update test expected output for warnings and CSS class fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Be more lax in function/methodnames tag in regards to whitespace

2 participants