Categorized: PHP

Articles pertaining to the development of PHP applications

HTTP 404 response causes forced downloads to fail

An interesting gotcha that I stumbled across recently, sending a 404 response code with a download forced by Content-Disposition: attachment will fail but inline content will still be displayed. This behaviour was tested in both Chrome and FireFox. Of course the appropriate response code should always be sent; this 404 response code was being sneaked in by WordPress and led to hours of frustration.… Read the rest

Late static binding workaround prior to PHP 5.3

A workaround for binding to the intended static scope without using the static:: operator introduced in PHP 5.3. The Issue When calling a parent method, we often want dynamic binding to occur so that any method calls and member references made in this parent method will be looked up starting in the true class of the object being invoked and then in the inheritance tree.… Read the rest