Make WordPress Core

Opened 6 years ago

Closed 5 years ago

#47663 closed defect (bug) (duplicate)

add_magic_quotes function transforms int to string

Reported by: mickaelperrin's profile mickaelperrin Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Hi,

I try to implement codecoverage of a WordPress module using https://github.com/sebastianbergmann/php-code-coverage.

The coverage fails with the following error:

FATAL ERROR. TESTS NOT FINISHED.
Uncaught TypeError: date() expects parameter 2 to be int, string given in /src/vendor/phpunit/php-code-coverage/src/Report/Html/Facade.php:63

The problem seems to be related to the function add_magic_quotes that converts int to string by calling addslashes on everything in $_SERVER.

It looks like type hinting in the test library won't be implemented: https://github.com/sebastianbergmann/php-code-coverage/issues/669

Does a type check on the add_magic_quotes function could be implemented without breaking other things?

Thanks,

Change History (3)

#2 @jrf
5 years ago

@mickaelperrin Thanks for bringing this up.

Even though this is an earlier ticket, I think this should be marked as a duplicate of #48605 which now has some potential patches for this issue. Or should it be the other way around and should I upload those patches here @SergeyBiryukov ?

#3 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Agreed, let's continue the discussion in #48605.

Note: See TracTickets for help on using tickets.