dist-archive-command
dist-archive-command copied to clipboard
Incorrect version number used when creating zip archive
Bug Report
- [x] Yes, I reviewed the contribution guidelines.
- [x] Yes, more specifically, I reviewed the guidelines on how to write clear bug reports.
Describe the current, buggy behavior
It looks like if there's a PHP file with a PHPdoc version number in the header like this, in a class file in the root folder of the plugin that isn't the main plugin file, it will be used instead of the actual plugin version number:
/**
* Class file
*
* @version 7.2.0
*/
Describe how other contributors can replicate this bug
- Create a folder
lifterlms
with a main plugin file with the standard plugin header (ie.lifterlms.php
)
<?php
/**
* Main LifterLMS plugin file
*
* @package LifterLMS/Main
*
* @since 1.0.0
* @version 5.3.0
*
* Plugin Name: LifterLMS
* Plugin URI: https://lifterlms.com/
* Description: Complete e-learning platform to sell online courses, protect lessons, offer memberships, and quiz students.
* Version: 7.6.0
* Author: LifterLMS
* Author URI: https://lifterlms.com/
* Text Domain: lifterlms
* Domain Path: /languages
* License: GPLv3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Requires at least: 5.9
* Tested up to: 6.5
* Requires PHP: 7.4
*
* * * * * * * * * * * * * * * * * * * * * *
* *
* Reporting a Security Vulnerability *
* *
* Please disclose any security issues or *
* vulnerabilities to [email protected] *
* *
* See our full Security Policy at *
* https://lifterlms.com/security-policy *
* *
* * * * * * * * * * * * * * * * * * * * * *
*/
- Create a file that's alphabetically before the main plugin file with the following header, ie.
class-lifterlms.php
<?php
/**
* Main LifterLMS class
*
* @package LifterLMS/Main
*
* @since 1.0.0
* @version 7.2.0
*/
- Run
wp dist-archive lifterlms
from thewp-content/plugins
folder
Expected
Creates zip archive with name lifterlms.7.6.0.zip
Actual
Creates zip archive with name liftrerlms.7.2.0.zip
Let us know what environment you are running this on
OS: Darwin 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:12:25 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6030 x86_64
Shell: /bin/zsh
PHP binary: /usr/local/Cellar/[email protected]/8.2.18/bin/php
PHP version: 8.2.18
php.ini used: /usr/local/etc/php/8.2/php.ini
MySQL binary: /usr/local/bin/mysql
MySQL version: mysql Ver 8.1.0 for macos14.0 on x86_64 (Homebrew)
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /Users/brianhogg/laravel/lifter2/wp-content/plugins/lifterlms
WP-CLI packages dir: /Users/brianhogg/.wp-cli/packages/
WP-CLI cache dir: /Users/brianhogg/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.10.0
Provide a possible solution
Other than removing the @version 7.2.0
header in the other class file I'm not sure a fix without checking the code that fetches the plugin version number. Likely just needs a tweak to what it's looking for to ignore @version
but grab Version:
Thanks for the report, @brianhogg ! This seems like a genuine bug.
Feel free to submit a pull request, if you'd like. Here is some guidance on our pull request best practices.