article thumbnail

CodeSOD: Monthly Totals

The Daily WTF

Daniel spotted an array called $months in a PHP application. Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. The data being stored in the array was some total of the sales of some commodity, for the past 5 months. That much all made sense.

PHP 107
article thumbnail

CodeSOD: Underscoring the Importance of Good Naming

The Daily WTF

Martin 's team had a problem in PHP. Being PHP, the empty function also doesn't check for empty strings, it checks for strings that can coerce to false (which includes the empty string, but also includes '0' ). See, the is_null function is, well, checking for nulls. It isn't checking for empty strings.

PHP 103
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: 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

CodeSOD: Holiday Sample Pack

The Daily WTF

On the other hand, submitter Born 2 Ruby, Forced 2 PHP was hired to work on a Ruby on Rails application, but after starting, discovered that the RoR app was an aspiration and the day to day work was to keep the legacy PHP application from falling over in production. Advertisement]. Keep the plebs out of prod.

PHP 98
article thumbnail

CodeSOD: Reading is a Safe Operation

The Daily WTF

Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. rmdir requires the target directory to be empty, so this recurses over all the files and subfolders in the directory, deleting them, so that we can delete the directory. Explore how!

PHP 60
article thumbnail

CodeSOD: Route to Success

The Daily WTF

Imagine you're building a PHP web application, and you need to display different forms on different pages. Now, for most of us, we'd likely be using some framework to solve this problem, but even if we weren't, the obvious solution of "use a different PHP file for each screen" is a fairly obvious solution.

PHP 60
article thumbnail

Web Development 2023: Understanding Dynamic Web Application Development

KitelyTech

This blog post focuses on dynamic web application development. In other words, we’ll be going over the advantages of dynamic web applications and how they impact businesses. What is Dynamic Web Application Development? Advertisements. Online advertisements have become vastly more sophisticated in recent years.