Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#12594 closed defect (bug) (fixed)

Use paths in include calls

Reported by: nacin's profile nacin Owned by: sorich87's profile sorich87
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Performance Keywords:
Focuses: Cc:

Description

We often do require('admin.php') where require('./admin.php') would be quicker, as it would avoid the include_path directive.

We should audit core for instances where we include a file (it'd generally be a bootstrap) without specifying a relative or absolute path.

Attachments (1)

path_patch.diff (45.2 KB) - added by sorich87 15 years ago.

Download all attachments as: .zip

Change History (10)

@sorich87
15 years ago

#1 @sorich87
15 years ago

  • Keywords has-patch added; needs-patch removed
  • Owner set to sorich87
  • Status changed from new to accepted

I added a relative path where no path is specified

#2 @nacin
15 years ago

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

(In [14139]) Use relative paths when including files, avoiding include_path. fixes #12594, props sorich87.

#3 @Viper007Bond
15 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Testing patches is a good idea. This completely breaks trunk.

Warning: require_once(./class-oembed.php) [function.require-once]: failed to open stream: No such file or directory in [...]\wp-includes\media.php  on line 1358

Fatal error: require_once() [function.require]: Failed opening required './class-oembed.php' (include_path='.;C:\php5\pear') in [...]\wp-includes\media.php on line 1358

#4 @Viper007Bond
15 years ago

That's from my localhost. Also breaks on my live block and scribu's localhost.

#5 @scribu
15 years ago

  • Keywords needs-patch added; has-patch removed
  • Priority changed from normal to highest omg bbq
  • Severity changed from normal to blocker

#6 @dd32
15 years ago

(In [14151]) Fix invalid paths in requires. See r14139. See #12594

#7 @dd32
15 years ago

Relative paths are taken from the calling script, not the current file.

So in those cases, it was trying to load ABSPATH/class-json.php

#8 @sorich87
15 years ago

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

Thanks dd32

#9 @nacin
15 years ago

  • Keywords needs-patch removed
  • Priority changed from highest omg bbq to normal
  • Severity changed from blocker to normal

My bad, sorry guys, I didn't have any embeds on my testbed. Completely missed that.

Note: See TracTickets for help on using tickets.