Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#43903 closed defect (bug) (invalid)

Plug-in concatenation Error

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

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
8 years ago

  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → 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.