[wp-trac] [WordPress Trac] #64830: Introduce a helper function to extract the major.minor "branch" version

WordPress Trac noreply at wordpress.org
Mon Mar 9 20:03:10 UTC 2026


#64830: Introduce a helper function to extract the major.minor "branch" version
-------------------------+------------------------------
 Reporter:  apermo       |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  General      |     Version:  3.2
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+------------------------------

Comment (by jorbin):

 For the automated tests, I would encourage using a dataProvider and test
 at least the following:


 {{{
 input   -> output
 7.0     -> 7.0   # Major ending with 0 and no minor
 7.0.0   -> 7.0   # minor number zero
 7.0.1   -> 7.0   # Minor with a major that ends in zero
 7.0.10  -> 7.0   # Double Digit Minor with trailing zero
 10.0.0  -> 10.0  # Double digit first part of major having a zero
 100.1.0 -> 100.1 # Triple digit since we don't want to introduce a bug in
 2050 something.
 }}}


 Further,
 https://core.trac.wordpress.org/browser/trunk/tests/phpunit/tests/functions/isWpVersionCompatible.php
 has some of the various ways version numbers can be messed up that would
 be good to ensure are handled correctly here.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64830#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list