Make WordPress Core

Opened 16 hours ago

Last modified 5 hours ago

#65497 new enhancement

Replace unnecessary PHP comment with HTML comment in wp-admin/customize.php

Reported by: harishtewari's profile harishtewari Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.9
Component: Customize Keywords: has-patch
Focuses: Cc:

Description (last modified by sabernhardt)

In src/wp-admin/customize.php (around line 227 and 266), there is a PHP opening tag used solely for an inline comment:

<ul class="customize-pane-parent"><?php // Panels and sections are managed here via JavaScript ?></ul>

Since no PHP code is being executed, the PHP tag is unnecessary. This can be replaced with an HTML comment to improve code readability and maintainability.
WordPress coding standards generally prefer avoiding unnecessary PHP tags when no PHP code is being executed

Change History (3)

This ticket was mentioned in PR #12241 on WordPress/wordpress-develop by @harishtewari.


16 hours ago
#1

https://core.trac.wordpress.org/ticket/65497

In src/wp-admin/customize.php (around line 227 and 266), there is a PHP opening tag used solely for an inline comment:

<ul class="customize-pane-parent"><?php Panels and sections are managed here via JavaScript ?></ul>

Since no PHP code is being executed, the PHP tag is unnecessary. This can be replaced with an HTML comment to improve code readability and maintainability.

WordPress coding standards generally prefer avoiding unnecessary PHP tags when no PHP code is being executed

Trac ticket:

## Use of AI Tools

#2 @sabernhardt
9 hours ago

  • Component changed from General to Customize
  • Description modified (diff)
  • Summary changed from Unnecessary PHP comment with HTML comment in wp-admin/customize.php to Replace unnecessary PHP comment with HTML comment in wp-admin/customize.php
  • Type changed from defect (bug) to enhancement
  • Version changed from 7.0 to 4.9

These comments were committed in r30102 and r41626.

#3 @dmsnell
5 hours ago

@harishtewari thanks for the proposal. it’s worth pointing out that this change modifies the rendered page and leaves what was previously a private comment in the public view.

did you find that the PHP tag was problematic in some way, or dig up that the comments were supposed to be part of the rendered page?

Note: See TracTickets for help on using tickets.