Skip to content

Cannot retrieve the version of an extension #17350

@SigmaFlame

Description

@SigmaFlame

Description

Description

When calling phpversion($extension) or using ReflectionExtension::getVersion() for any PHP extension, the returned value is the current PHP version (8.4.2 in my case) instead of the specific version of the extension.

The only exception observed is the xdebug extension, which correctly returns its version. This issue affects all other extensions tested, including core extensions like tidy, curl, and others.

Steps to Reproduce

  1. Use the following code snippet:

    <?php
    echo "PHP Version: " . PHP_VERSION . PHP_EOL;
    
    $extensions = ['mysqli', 'curl', 'xdebug'];
    foreach ($extensions as $ext) {
        echo "phpversion('$ext'): " . phpversion($ext) . PHP_EOL;
    
        $reflection = new \ReflectionExtension($ext);
        echo "ReflectionExtension::getVersion('$ext'): " . $reflection->getVersion() . PHP_EOL;
    }
  2. Run the script.

Expected Result

phpversion($extension) and ReflectionExtension::getVersion() should return the version of the specified extension, not the PHP version.

Actual Result

For most extensions, both functions return the PHP version (8.4.2) instead of the extension version. The xdebug extension is the only one that behaves correctly.

PHP Version

8.4.2

Operating System

Tested on Windows 10 throught Wampserver 3.3.7 64 bits.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions