PCRE functions in PHP silently swallow errors, return inconsistent values, and
preg_last_error lies when you need it the most. I break down all the pitfalls
of both compilation and execution and show how to get out of it — ideally
through exceptions and without losing your sanity.
XSS is everywhere, most experts flounder when it comes to escaping, and the most
critical security point is handled by a coder without the necessary expertise.
The solution? Latte templates in Nette Framework escape automatically and
context-aware – a killer feature that no competing PHP framework has to
this day.
Half of all websites are full of holes because of something that is
fundamentally a trivial character substitution. I've written the definitive
overview of escaping for all contexts – HTML, SQL, JavaScript, CSS, URL –
because the confusion around this simple thing is an immortal evergreen.
A design pattern that promises uniqueness but can't even handle a clone. Step
by step, I break down how every attempt to save the singleton's life –
whether it's testability, global state, or repetitive code – inevitably
leads to its funeral.
A tiny PHP library that handles OAuth so you don't have to. Post updates,
attach photos, search hashtags, pull timelines – all in a few lines of code.
Because life's too short for hand-rolling cURL calls against Twitter's API.
Overlapping tags, ambiguous markup, permitted hacks – all myths. The facts
show that the difference between HTML and XHTML is surprisingly close to zero.
The real story lies elsewhere: in the transition from SGML to XML, which brought
its own set of problems.
Ruby lets anyone redefine any method in any class, and Rails does exactly that
to the standard library with a big smile. Sounds like freedom? It's the kind of
freedom where someone else's “improvement” silently breaks your code.
A good framework, sure, but one that makes you its servant.
IE on Windows XP turned longer form buttons into jagged monsters. All it takes
is overflow: visible and the elegant CSS selector
input.button[class], which IE ignores – a valid fix without
underscore hacks and conditional comments.
How to design software the right way? Write it, figure out what you need, and
then write it again. Texy2 is exactly that second attempt – precise,
maximally flexible, and capable of handling even crazy edge cases. I almost
didn't release it, but in the end they talked me into it.
The documentation is silent, Google is silent, but I'm not. registerNodeClass()
lets you sneak your own classes into DOMDocument instead of the standard
ones – and suddenly every parsed element has your methods. Small function,
big difference.