article thumbnail

CodeSOD: PHP Error Logging

The Daily WTF

Today's anonymous submitter sends us some PHP exception logging code. This particular code shows a surprising understanding of some clever PHP tricks. Now, a normal developer would just take advantage of the Throwable 's built in string conversion to get that information. None of that is necessary. Download today!

PHP 56
article thumbnail

Multilingual Development

The Daily WTF

Bert was a developer on one of the web teams and wanted to integrate their applications into IniERP. You see, Bert was a PHP developer. He was building a PHP application. But he copy/pasted Lisa's Java code into a PHP file, and then remangled it until it was executable PHP. It's not PHP."

Insiders

Sign Up for our Newsletter

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Trending Sources

article thumbnail

CodeSOD: Monthly Totals

The Daily WTF

Daniel spotted an array called $months in a PHP application. But I've never seen them abused like this - a magical, cryptic code that only the developer responsible for this horror could love. Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift.

PHP 107
article thumbnail

CodeSOD: To Tell the Truth

The Daily WTF

So many languages eschew "truth" for "truthiness" Today, we're looking at PHP's approach. PHP automatically coerces types to a boolean with some fairly simple rules: the boolean false is false the integer 0 is false, as is the float 0.0 In pure PHP, anything non-zero is true, but here only 1 is true.

PHP 64
article thumbnail

Web Development 2023: Understanding Dynamic Web Application Development

KitelyTech

In this age of digital transformation, businesses are looking to the internet as an opportunity to collaborate and develop ideas faster than ever. This blog post focuses on dynamic web application development. What is Dynamic Web Application Development? Why Use Dynamic Website Development? Advertisements.

article thumbnail

CodeSOD: List All Your Arguments

The Daily WTF

Pedro inherited a PHP application, and the previous developer had some opinions about how to handle arguments to functions. First, the $fullName line doesn't work as intended, since arrays in PHP are zero indexed. But "smash the arguments into an array" is a common feature of this developer's code.

PHP 56
article thumbnail

CodeSOD: Around 20 Meg

The Daily WTF

You see, their PHP application allowed file uploads. The developer's instincts weren't entirely bad. Why was the developer rounding in the first place? "Because 20 is an integer, and I wanted to compare integers. PHP doesn't have a built in trunc method." Advertisement]. So I rounded.

PHP 56