Bubble Foundry

Posts tagged with: PHP

Deconstructing a WordPress PHP Infection
I spent this morning cleaning up infected PHP files (yet another reason why I think WordPress needs to die), but in doing so I got to see lots of infected code. By that I mean that things like the following were inserted at the top of existing PHP files on this server anything else: 1 […] Read more – ‘Deconstructing a WordPress PHP Infection’.
Because I love making stupid little libraries I’m proud to present CAP, “CAP is an experiment is stateful PHP form handling.” As you can see, closures are bound to form elements. Pretty cool, no? PHP 5.3+ only. Read more – ‘CAP’.
PHP Closures
PHP 5.3 has added support for true anonymous functions and closures. Unfortunately, there are a few gotchas. The main one is that no variables are automatically enclosed: you must specify the variables you want to enclose. So, this will cause an exception: $a = 2; $f = function($i) { return $i + $a; } $f(1); […] Read more – ‘PHP Closures’.
I’ve been doing a bunch of PHP programming the last few weeks for a client and it’s been such a pain to use PHP’s archaic array_* methods. And don’t get me started on having to return arrays like array('result' => 'not_ok', 'message' => 'User not found') to indicate success or failure. I had some time […] Read more – ‘BFCollections’.
Typecasting Strings to Integers in PHP
PHP does some funny things when typecasting strings as integers and may not work the way you would expect (to be fair, it is documented). Here are some examples running under PHP 5.2.5 from the Mac OS X command line: php -r 'var_dump((int) "agbae");' int(0) php -r 'var_dump((int) "zzzzzzzzzzzzzzzzzzzzzzz");' int(0) php -r 'var_dump((int) "2agbae");' int(2) […] Read more – ‘Typecasting Strings to Integers in PHP’.
From the Laboratory: Image Resizing and Thumbnail Creation
This is the first in a series of posts on technical issues related to web site development and making user-friendly websites. These will focus on the technical details of developing web sites and applications so will probably be interesting to only a subset of readers. Within the next few months, time permitting, we will be […] Read more – ‘From the Laboratory: Image Resizing and Thumbnail Creation’.