Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#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 |
- title is empty (literally) – url-title empty, article listed as Untitled – fair enough
- title contains spaces only – url-title set with “%20”, article title blank in list tab, not listed under recent articles – hmm …
- title set to a zero – url-title set to a zero, article listed as Untitled – yikes!
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 thanempty($Title)
to determine whether the article is untitled
Or maybe it’s all too arcane & inconsequential to bother with? Open to the floor …
Offline
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
Pages: 1