- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I could make a cross-lingual joke about
PUE
and say that it stinks...Admin
Given that the only intelligible name is "stripmagic" maybe we're all better off not knowing what the abbreviations stand for...
Admin
I remember in my first job in the early 1980s there was a contractor who used butterfly names for variables (I don't recall the language).
Admin
Probably Latin if they were using the scientific names
Admin
My guess given the context: PHSC may do a little something else as well, but is a wrapper around htmlspecialchars
Admin
There are no backreferences in the regexp PVSE.
$(?=\n)
is a lookahead. I think it matches a line containing only whitespace characters, and replaces it with a line containing<:vspace>
.Maybe Remy was thinking of PUE. It uses the
e
modifier that allows expressions to be used in the replacement string. This modifier is obsolete, its functionality is now in thepreg_replace_callback()
function. PUE looks like it's essentially doing the same thing asurlencode()
.Admin
I meant lookahead, but forgot that word and used backreference instead. Oops.
Admin
That’s PmWiki.
https://www.pmwiki.org/wiki/PmWiki/Functions https://www.pmwiki.org/wiki/PmWiki/FunctionList
Admin
I've started to ask ChatGPT to code review and summarize these articles. It's been an interesting experiment. Sometimes it catches things that the author doesn't but I also like to see what it makes of it and what it refactors to. I like its suggested names for the functions. It's not 100% but I think they make sense.
strip_magic pretty_print process_escaped_quotes process_vertical_spacing process_vertical_spacing_escaped set_default set_default_array percent_encode
Admin
What is wrong with people?
Admin
In my first programming class in college I deliberately gave variables nonsense names that were easily confused, like SINSHACK and SHINSACK. (I’m not sure why any more.) I quickly learned why this was a bad idea.
Admin
The only real issue is that the code is taken out of context.
These are all PHP equivalents to one-line macros as we'd have found in any C program a few decades ago. MFC headers come to mind for example. Such macros are basically "write only" and the common programmer is not expected to understand how they're implemented.
As Remy puts it "I don't even want to know" and that's really the point here. You don't need to know. TRWTF is that the submitter of this snippet omitted the context -- a wiki, as found by Maxim. If that had been provided, I'm sure we wouldn't even be discussing it here.
Admin
It has been many years since I saw an API that bad, and then that was for an obfuscated coding competition, so I guess that makes pmwiki the real WTF.
Admin
I've seen lots of horrible code on this blog, but this one really takes the cake. WTF were they thinking? This looks almost like deliberate obfuscation; assembly language mnemonics are more intuitive than the function names used here.
Admin
That would explain use of PRE tag. pre_r is pretty simple function to understand.
Admin
How many of us have worked with people who removed comments thinking it would gain performance.
Admin
Magic quotes has been removed from PHP in 2012. This must be some truly ancient code.