WordPress.org

Make WordPress Core

Opened 3 months ago

Closed 3 months ago

#43903 closed defect (bug) (invalid)

Plug-in concatenation Error

Reported by: kaine78 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.5
Component: Editor Keywords: needs-testing
Focuses: Cc:

Description

In plugin-settings.php when a variable is concatenated in the format of:

<?php
$x = "Hello " . $i+1;

the result evaluates to $x = "1".

Haven't done full testing but these results turn out fine:

<?php
$x = $i+1."Hello";
$x = "Hello".1+$i;

Change History (1)

#1 @SergeyBiryukov
3 months ago

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

Hi @kaine78, welcome to WordPress Trac!

There's no plugin-settings.php file in WordPress core. The observed behavior is the result of PHP type casting due to the dot operator having the same precedence as + and -. I don't see a WordPress bug here.

Note: See TracTickets for help on using tickets.