php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76736 Tidy's Reflection arginfo is wrong for some global functions
Submitted: 2018-08-13 13:16 UTC Modified: 2020-04-16 10:39 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: tysonandre775 at hotmail dot com Assigned: nikic (profile)
Status: Closed Package: Tidy (PECL)
PHP Version: 7.1.20 OS: Any
Private report: No CVE-ID: None
 [2018-08-13 13:16 UTC] tysonandre775 at hotmail dot com
Description:
------------
The second argument (Tidy instance) is mandatory.

See http://php.net/tidy_getopt - Because the same arginfo from the method is reused, the global function has incorrect reflection signatures.

For the global functions, PHP 7.1 and newer are affected



https://github.com/php/php-src/pull/3439/files was an earlier, incorrect attempt at fixing this, before noticing that I needed to stop reusing arginfo and that additional methods such as tidy_repair_string() also had incorrect signatures.

- 

Test script:
---------------
var_export((new ReflectionFunction('tidy_getopt'))->getParameters());
// Same for tidy_get_root(), tidy_get_html(), tidy_get_head(), tidy_get_body(), tidy_repair_string(), and probably even more global functions

Expected result:
----------------
Expected: Both $option and $object should exist as required parameters on tidy_getopt.

The reflection signature of Tidy::getOpt(), etc. should not be changed by any bug fix.

Actual result:
--------------
Observed: Only one required parameter is rec

array (
  0 => 
  ReflectionParameter::__set_state(array(
     'name' => 'option',
  )),
)


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-08-14 13:48 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2020-04-16 10:39 UTC] nikic@php.net
-Status: Verified +Status: Closed -Assigned To: +Assigned To: nikic
 [2020-04-16 10:39 UTC] nikic@php.net
Fix in PHP 8 as part of stubs migration.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC