Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect version number used when creating zip archive #92

Open
2 tasks done
brianhogg opened this issue May 1, 2024 · 1 comment · May be fixed by #93
Open
2 tasks done

Incorrect version number used when creating zip archive #92

brianhogg opened this issue May 1, 2024 · 1 comment · May be fixed by #93

Comments

@brianhogg
Copy link

brianhogg commented May 1, 2024

Bug Report

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 team@lifterlms.com   *
 *                                         *
 * 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 the wp-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/php@8.2/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:

@danielbachhuber
Copy link
Member

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.

@swissspidy swissspidy linked a pull request May 2, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants