php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69141 Missing arguments in reflection info for some builtin functions
Submitted: 2015-02-27 20:39 UTC Modified: -
From: kostyantyn dot lysyy at oracle dot com Assigned:
Status: Closed Package: Reflection related
PHP Version: master-Git-2015-02-27 (Git) OS: Debian Linux
Private report: No CVE-ID: None
 [2015-02-27 20:39 UTC] kostyantyn dot lysyy at oracle dot com
Description:
------------
But reflection does not see the more recently added argument for some common functions:

Here are the ones I've noticed:
- setcookie (missing "httponly")
- setrawcookie (missing "httponly")
- spl_autoload_register (missing 2 optional params)
- mktime  (missing "is_dst")
- gmmktime (missing "is_dst")

spl_autoload_register seems to be fixed in 'master' so I did not include it in the fix.


Test script:
---------------
<?php
$functionsWithMissingReflectionParams = array(
     'setcookie'             => 7
    ,'setrawcookie'          => 7
    ,'spl_autoload_register' => 3 // missing in php 5.6.2-1
    ,'mktime'                => 7
    ,'gmmktime'              => 7
);
foreach($functionsWithMissingReflectionParams as $funcName => $expectCount)
{
    $refl = new ReflectionFunction($funcName);
    if($expectCount != count($refl->getParameters()))
        printf("'%s' has %d != %d params, according to reflection\n",
            $funcName, count($refl->getParameters()), $expectCount);
    else
        unset($functionsWithMissingReflectionParams[$funcName]);
}
if(!$functionsWithMissingReflectionParams)
    echo "Everything works fine!\n";

Expected result:
----------------
Everything works fine!

Actual result:
--------------
'setcookie' has 6 != 7 params, according to reflection
'setrawcookie' has 6 != 7 params, according to reflection
'spl_autoload_register' has 1 != 3 params, according to reflection
'mktime' has 6 != 7 params, according to reflection
'gmmktime' has 6 != 7 params, according to reflection


Patches

add.missing.reflection.args.master.patch (last revision 2015-02-27 20:39 UTC by kostyantyn dot lysyy at oracle dot com)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-02-28 08:49 UTC] reeze@php.net
Automatic comment on behalf of reeze
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f824f91ac95000c7a6e60117d00088c253e16213
Log: Fixed bug #69141 Missing arguments in reflection info for some builtin functions
 [2015-02-28 08:49 UTC] reeze@php.net
-Status: Open +Status: Closed
 [2015-02-28 08:49 UTC] reeze@php.net
Automatic comment on behalf of reeze
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f824f91ac95000c7a6e60117d00088c253e16213
Log: Fixed bug #69141 Missing arguments in reflection info for some builtin functions
 [2015-02-28 08:50 UTC] reeze@php.net
Automatic comment on behalf of reeze
Revision: http://git.php.net/?p=php-src.git;a=commit;h=f824f91ac95000c7a6e60117d00088c253e16213
Log: Fixed bug #69141 Missing arguments in reflection info for some builtin functions
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC