Opened 4 weeks ago
Closed 2 weeks ago
#65888 closed enhancement (fixed)
Remove the unused wp-profiler.php from the PHPUnit test suite
| Reported by: | lancewillett | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 7.2 |
| Component: | Build/Test Tools | Version: | |
| Severity: | normal | Keywords: | has-patch has-unit-tests |
| Cc: | Focuses: |
Description (last modified by )
tests/phpunit/includes/wp-profiler.php defines WPProfiler and the wppf_start() / wppf_stop() helpers. Nothing uses it, and it cannot run.
No callers
- No references to
wp-profiler,wppf_start, orWPProfileranywhere insrc/ortests/. tests/phpunit/includes/bootstrap.phpnever loads it.
It cannot run
WPProfiler::start() reads four properties from the global object cache:
$wp_object_cache->cold_cache_hits $wp_object_cache->warm_cache_hits $wp_object_cache->cache_misses $wp_object_cache->dirty_objects
None of the four exist in src/wp-includes/class-wp-object-cache.php, and none exist in the test drop-in at tests/phpunit/includes/object-cache.php. Calling it would raise undefined-property notices, which this suite treats as failures — phpunit.xml.dist sets both convertNoticesToExceptions="true" and failOnRisky="true".
History
The file arrived with the 2013 initial import of the unit-tests repository into develop.svn. It has had 16 commits since, all janitorial: coding standards, docblock formatting, spacing, access modifiers, PHP4 constructor removal. None changed its behaviour. The most recent touch was a docblock fix in 2024.
#46505 illustrates the cost — an enhancement milestoned for 5.2 that added access modifiers to this file.
So core has spent over a decade applying standards sweeps and review time to a file that is both unreferenced and non-functional.
Proposed
Delete tests/phpunit/includes/wp-profiler.php.
If per-block profiling of the test suite is wanted later, it is better written against the current object-cache API than revived from this one.
Change History (6)
This ticket was mentioned in PR #13092 on WordPress/wordpress-develop by @lancewillett.
4 weeks ago
#3
- Keywords has-patch has-unit-tests added
## What this changes
Removes the unused tests/phpunit/includes/wp-profiler.php file.
The profiler has no callers and is never loaded by the PHPUnit bootstrap. Its object-cache instrumentation also depends on properties that are no longer available.
Removing it prevents future maintenance work on test tooling that cannot run. If profiling is needed later, it can be built against the current test suite and object-cache APIs.
## Testing
git diff --checkpassed.- Confirmed no references to
wp-profiler,WPProfiler, or itswppf_*()helpers remain. - Confirmed the PHPUnit bootstrap does not load the profiler.
No runtime tests were added because this removes unreachable tooling.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Followed this back into the old
unit-testsSVN repository, which is still reachable atunit-tests.svn.wordpress.org(currently r1337). It answers the question the description left open.All revision numbers below are from that repository, not core.
The file has never had a live caller
wp-testcase/test_import_wp.phpgains the only reference the file has ever had, and it is commented out from the start:#include_once(DIR_TESTROOT.'/wp-testlib/wp-profiler.php');.svn blameattributes that line to [79/tests], and it was never modified again.I checked for callers at [120/tests], at [407/tests], and at the repository's final state. Zero in every case, apart from that one commented-out include.
The cache instrumentation broke in 2008
[120/tests] was correct when it was written. WordPress 2.3's
wp-includes/cache.phpdid definecold_cache_hits,warm_cache_hits,cache_missesanddirty_objects. They were gone by WordPress 2.5 and have not existed since.So the four properties
WPProfiler::start()reads have been absent from core for roughly 18 years.Effect on this ticket
The closing caveat in the description is no longer needed. The pre-2013 history is available and it shows the file was never wired up in the first place, rather than having fallen out of use later.