php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74386 Phar::__construct : wrong number of parameters by reflection
Submitted: 2017-04-06 16:23 UTC Modified: 2017-05-06 11:59 UTC
From: fabien dot villepinte at gmail dot com Assigned:
Status: Closed Package: PHAR related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: fabien dot villepinte at gmail dot com
New email:
PHP Version: OS:

 

 [2017-04-06 16:23 UTC] fabien dot villepinte at gmail dot com
Description:
------------
According the documentation the method Phar::__construct( http://php.net/manual/en/phar.construct.php ) has only 3 parameters but by using reflection we can see there is a 4th parameter ("fileformat").

Test script:
---------------
<?php

$rm = new ReflectionMethod(Phar::class, "__construct");

foreach ($rm->getParameters() as $param) {
    printf("param #%d: %s%s\n", $param->getPosition(), $param->getName(), $param->isOptional() ? " (Opt.)" : "");
}

Actual result:
--------------
param #0: filename
param #1: flags (Opt.)
param #2: alias (Opt.)
param #3: fileformat (Opt.)

Patches

Pull Requests

Pull requests:

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-05-06 11:59 UTC] fabien dot villepinte at gmail dot com
-Summary: Phar::__construct : undocumented parameter +Summary: Phar::__construct : wrong number of parameters by reflection -Type: Documentation Problem +Type: Bug
 [2017-05-06 11:59 UTC] fabien dot villepinte at gmail dot com
Phar::__construct expects at most 3 parameters, otherwise we get the following error:

PHP Fatal error:  Uncaught ArgumentCountError: Phar::__construct() expects at most 3 parameters, 4 given
 [2017-05-29 07:32 UTC] krakjoe@php.net
Automatic comment on behalf of fabien.villepinte@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=2dee44c74c00636558b26f764232045127a5d1dd
Log: Fix Bug #74386 Phar::__construct(): wrong number of parameters by reflection
 [2017-05-29 07:33 UTC] krakjoe@php.net
-Status: Open +Status: Closed
 [2017-05-29 07:33 UTC] krakjoe@php.net
Automatic comment on behalf of fabien.villepinte@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=d6922ef8e3dbf99bf8bda99dbfbfb4b74d1a2eb8
Log: Fix Bug #74386Phar::__construct(): wrong number of parameters by reflection
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC