Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Toptal.com:
Buggy PHP Code: The 10 Most Common Mistakes PHP Developers Make
Oct 07, 2016 @ 16:12:27

On the Toptal.com site a new article has been published from author Ilya Sanosyan with his list of top ten development mistakes he sees PHP developers make leading to more buggy code.

PHP makes it relatively easy to build a web-based system, which is much of the reason for its popularity. But its ease of use notwithstanding, PHP has evolved into quite a sophisticated language with many frameworks, nuances, and subtleties that can bite developers, leading to hours of hair-pulling debugging. This article highlights ten of the more common mistakes that PHP developers need to beware of.

Included in his list are common issues like:

  • Leaving dangling array references after foreach loops
  • Confusion about returning by reference vs. by value
  • Performing queries in a loop
  • Assuming $_POST will always contain your POST data
  • Ignoring coding standards

For each item on his list he provides good code examples and explanation of both why it's an issue and what can be done to prevent it.

tagged: top10 common mistakes programmers developers list example code

Link: https://www.toptal.com/php/10-most-common-mistakes-php-programmers-make

SitePoint PHP Blog:
7 More Mistakes Commonly Made by PHP Developers
Jul 25, 2014 @ 16:29:28

Following several other posts with the "common mistakes PHP developers make" theme, Bruno Skvorc has posted his own list of seven things he sees developers doing over and over.

Back at the end of June, TopTal, the freelance marketplace, published a post about 10 Most Common Mistakes PHP Programmers Make. The list wasn’t exhaustive, but it was well written and pointed out some very interesting pitfalls one should be wary of – even if I wouldn’t personally list the mistakes as very common. I encourage you to give it a thorough read – it has some truly valuable information you should be aware of – especially the first eight points.

His additions to the list of common mistakes includes:

  • Using the mysql extension
  • Not rewriting URLs
  • Assigning in Conditions
  • Being Too Transparent

You can read the full list and summaries of each in the rest of the post.

tagged: common mistakes list more

Link: http://www.sitepoint.com/7-mistakes-commonly-made-php-developers/

Anna Filina:
Common PHP Mistakes
Jul 21, 2014 @ 18:53:31

Anna Filina has posted her own addendum to a top ten list of common PHP programmer mistakes, adding seven more of her own.

I was recently asked by one of my readers to give feedback on the following article he read: 10 Most Common PHP Mistakes. It is well written and very thorough. Most of the tips are specific to PHP, others are about web programming in general or database performance. It’s a very good read. I was also asked to contribute to this list, so here are 7 more tips.

Her list of seven touches on topics like caching, allowing SQL injection, disabling error reporting and ignoring accessibility. She also includes some configuration settings, code and links to other tools/resources to help provide information on preventing these other mistakes.

tagged: common programmer mistakes additional tips

Link: http://afilina.com/common-php-mistakes/

Toptal Blog:
10 Most Common PHP Mistakes
Jul 17, 2014 @ 17:52:40

On the Toptal blog Ilya Sanosyan has a post sharing what he sees as the top ten most common mistakes PHP developers make on a day to day basis. While most of the tips are code-specific there are one or two that are a bit more abstract.

PHP makes it relatively easy to build a web-based system, which is much of the reason for its popularity. But its ease of use notwithstanding, PHP has evolved into quite a sophisticated language, with many nuances and subtleties that can bite developers, leading to hours of hair-pulling debugging. This article highlights ten of the more common mistakes that PHP developers need to beware of.

Among the items on his list are things like:

  • Leaving dangling array references after foreach loops
  • Confusion about returning by reference vs. by value
  • Memory usage headfakes and inefficiencies
  • Assuming $_POST will always contain your POST data
  • Thinking that PHP supports a character data type

Each of the items comes with a good description, some code and suggestions on how to avoid and/or fix it in your applications.

tagged: common language mistakes top10 list

Link: http://www.toptal.com/php/10-most-common-mistakes-php-programmers-make

Timoh's Blog:
PHP data encryption cheatsheet
Jun 17, 2014 @ 15:52:44

Timoh has published a data encryption cheatsheet to his blog today. It's "a short guide" to help you prevent some of the more common encryption-related problems in your application, specifically around symmetric data encryption.

This cheatsheet assumes a “client-server” situation, which is probably a typical case with PHP applications. Naturally the recommendations given here are not the “only possible way” to handle data encryption in PHP, but this cheatsheet aims to be straightforward and tries to leave less room for mistakes and (possibly confusing) choices.

The cheatsheet includes information on topics like:

  • Encryption algorithm / mode of operation / nonce (initializing vector)
  • Encryption and authentication keys
  • Key stretching
  • Key storage and management
  • Data compression

It's jam-packed full of great information, so definitely check it out if you're doing any kind of encryption in PHP.

tagged: data encryption cheatsheet common mistakes

Link: https://timoh6.github.io/2014/06/16/PHP-data-encryption-cheatsheet.html

Smashing Magazine:
My Favorite Programming Mistakes
Jul 08, 2011 @ 18:57:21

On the Smashing Magazine site there's a post some of Paul Tero's favorite programming mistakes he's come across and heard of in his time programming.

I like to classify these mistakes into three broad groups: cock-ups (or screw-ups in American English), errors and oversights. A cock-up is when you stare blankly at the screen and whisper "Oops": things like deleting a database or website, or overwriting three-days worth of work, or accidentally emailing 20,000 people. Errors cover everything, from simple syntax errors like forgetting a } to fatal errors and computational errors.

Included in his list are things like:

  • Leaving Debug Mode On
  • Turning Debug Mode Off
  • Wrong Variable Type
  • 1p Errors

Examples of each are included with both code and descriptions as well as "lessons learned" to help you not make the same mistakes in your applications.

tagged: programming mistakes experience

Link:

NETTUTS.com:
Are You Making These 10 PHP Mistakes?
Feb 04, 2009 @ 15:33:51

All of you developers out there, NETTUTS.com has a question for you - are you making any of these ten PHP mistakes in your day to day development? Which ones, you ask? Read on...

Here are 10 PHP mistakes that any programmer, regardless of skill level, might make at any given time. Some of the mistakes are very basic, but trip up even the best PHP programmer. Other mistakes are hard to spot (even with strict error reporting). But all of these mistakes have one thing in common: They're easy to avoid.

Here's the list (as Glen Stanberry sees it):

  • Single quotes, double quotes
  • Semicolon after a While
  • NOT Using database caching
  • Missing Semicolon After a Break or a Continue
  • Not Using E_ALL Reporting
  • Not Setting Time Limits On PHP Scripts
  • Not Protecting Session ID's
  • Not Validating Cookie Data
  • Not Escaping Entities
  • Using Wrong Comparison Operators
tagged: mistakes list common quotes semicolon error session cookie escape

Link:

John Coggeshall's Blog:
Top 30 Scalability Mistakes Slides
Oct 11, 2006 @ 12:06:15

John Coggeshall has linked to the download of the slides from his latest (and very popular) conference talk - Top 30 Scalability Mistakes.

For those of you who are interested, you can download my slide from the tutorial I gave at ApacheCon this year. This is a very popular talk that I've been giving all year -- and this is by far the most extensive version of the talk yet.

The slides cover topics like system scalability, PHP scalability, database scalability, web server scalability, and using these tips to optimize your application.

tagged: slides talk apachecon2006 scalability mistakes optimize slides talk apachecon2006 scalability mistakes optimize

Link:

John Coggeshall's Blog:
Top 30 Scalability Mistakes Slides
Oct 11, 2006 @ 12:06:15

John Coggeshall has linked to the download of the slides from his latest (and very popular) conference talk - Top 30 Scalability Mistakes.

For those of you who are interested, you can download my slide from the tutorial I gave at ApacheCon this year. This is a very popular talk that I've been giving all year -- and this is by far the most extensive version of the talk yet.

The slides cover topics like system scalability, PHP scalability, database scalability, web server scalability, and using these tips to optimize your application.

tagged: slides talk apachecon2006 scalability mistakes optimize slides talk apachecon2006 scalability mistakes optimize

Link:

Alan Knowles' Blog:
Code Reviewing.
Aug 21, 2006 @ 12:56:39

In a great new post from Alan Knowles he takes a look at code reviewing, specificaly in a PHP environment.

He breaks the post up into phases (one through four) with the steps outlined along the way (including the "oh sh*t, it's getting urgent, we better fix the delivered code and make it work well enough for the client to start testing" phase). Phase four is the largest, being the bug finding and fixing stage, some of the more intensive (and sometimes numbing) times of development.

He also includes a good, long list of some of the codeing standards he's accumulated over time, including:

  • Not creating PHP includes with functions in them!
  • Never hard code email subjects etc. in code, use templates.
  • Not using libraries that where not specified.. or using non-PEAR libraries when PEAR ones are available...
  • Everything extends the base class, even code run via cron jobs.

He also talks about using print rather than echo, exiting on XMLHttpRequest calls, shortcuts in Javascript, and cloning dataobject arrays over creating simple structs.

tagged: review phase coding standards list mistakes review phase coding standards list mistakes

Link:


Trending Topics: