WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#12167 closed defect (bug) (fixed)

Syntax Error in PHP4

Reported by: blepoxp Owned by: westi
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Warnings/Notices Keywords: has-patch tested
Focuses: Cc:

Description

Steps to reproduce:
1) Load WordPress trunk (r. 13013) in PHP4
2) Observe following error on screen:

Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /Applications/MAMP/htdocs/wptrunk/wp-includes/theme.php on line 714

It appears that the arrow is causing the problem

$author = get_user_by( 'id', $author_id )->user_nicename;

I fixed by doing the following:

$author = get_user_by( 'id', $author_id );
$author = $author->user_nicename;

Attachments (2)

theme.php (40.1 KB) - added by blepoxp 4 years ago.
Adds a new line after 714.
theme.diff (425 bytes) - added by blepoxp 4 years ago.
Sorry. Here's the .diff version

Download all attachments as: .zip

Change History (7)

blepoxp4 years ago

Adds a new line after 714.

comment:1 aaroncampbell4 years ago

You'll need to create a patch rather than upload the whole file. A patch is basically a .diff file that shows what CHANGES are made to the file and can be applied to the repository.

blepoxp4 years ago

Sorry. Here's the .diff version

comment:3 nacin4 years ago

  • Keywords has-patch added; theme removed
  • Milestone changed from 2.9.2 to 3.0

FYI: There's no other instance of function_that_returns_object()->method() or function_that_returns_object()->property in core. This one is it (according to grep).

I wrote it in [12915] forgetting about the PHP4 compat issue.

comment:4 aaroncampbell4 years ago

  • Keywords tested added

Looks good, quick test seems to be working.

comment:5 westi4 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [13014]) Ensure we are PHP4 compat. Fixes #12167 props blepoxp.

Note: See TracTickets for help on using tickets.