Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-02-01 01:43:34

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Article title inconsistencies

There seem to be some inconsistencies regarding “blank/empty” article titles. Consider the following scenarios:

Article title URL-only title Article list tab Recent articles list
1. empty empty Untitled Untitled x
2. space %20 blank not listed
3. 0 0 Untitled Untitled x
  1. title is empty (literally) – url-title empty, article listed as Untitledfair enough
  2. title contains spaces only – url-title set with “%20”, article title blank in list tab, not listed under recent articles – hmm …
  3. title set to a zero – url-title set to a zero, article listed as Untitledyikes!

All this is a consequence of using the PHP empty() function but I wonder if it would be better to:

  • trim() the article title before checking it’s contents, and before storing it in the database
  • use something like $Title == '' rather than empty($Title) to determine whether the article is untitled

Or maybe it’s all too arcane & inconsequential to bother with? Open to the floor …

Offline

#2 2013-02-01 02:19:19

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Article title inconsistencies

Same issues and inconsistencies hold true elsewhere. The dev branch have lifted some of them, but the source has bad programming practices. One of these is the use of PHP’s equal operator (instead of identical) and all around believing that SQL leads to the same results.

This creates all sort of issues and some cases even potential security vulnerabilities. Equal operator is sort of bitch.

Offline

#3 2013-02-01 02:45:56

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: Article title inconsistencies

Gocom wrote:

Same issues and inconsistencies hold true elsewhere. The dev branch have lifted some of them, but the source has bad programming practices. One of these is the use of PHP’s equal operator (instead of identical) and all around believing that SQL leads to the same results.

This creates all sort of issues and some cases even potential security vulnerabilities. Equal operator is sort of bitch.

Ho hum … sometimes it doesn’t bear thinking about.

But whilst we’re on the subject of “consequences” here’s another query

Offline

Board footer

Powered by FluxBB