Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#15300 closed defect (bug) (invalid)

array instead of string in formatting.php

Reported by: jeje68630's profile jeje68630 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Formatting Keywords: formatting.php, strip_tags, sanitize_title
Focuses: Cc:

Description

Hi,

I stumbled on a problem. It seems to rise only with a specific theme. However, I'm not sure why it produced that result.
This problem appeared when I changed of web hosting.

So I had a warning that told me that in formatting.php line 794 an array was passed to strip_tags instead of a string.
It happened only when displaying a single post.
Besides, the website layout was kind of mixed in the botton of the page, just as if the css was going crazy.

I debugged the thing and trace the variable.

On line 794, it's the sanitize_title function. The error was raised probably because of my permalinks that was set like that : %category%/%title%

Instead of having a string mycategory/mypostitle, the $title variable was filled with :
title[0] : mycategory
title[1] : myposttitle

So I forced the $title to be a string. And it seems to work.
Line 794 : strip_tags((string)$title));

Change History (1)

#1 @scribu
14 years ago

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

This is definitely a bug in the theme.

Instead of casting to a string, you should call debug_print_backtrace() inside sanitize_title() and fix the cause of the problem, not the effect.

Note: See TracTickets for help on using tickets.