Add a T_PAAMAYIM_NEKUDOTAYIM to fix PHP code

When the errors are designed to confuse you.

Imagine working for 12 hours straight, without talking any break. You build modules, tools, and your to do list keeps getting shorter and shorter. You don't want to stop because you are in the zone. Your mojo is up the roof. But suddenly you get this Error:

PHP expects T_PAAMAYIM_NEKUDOTAYIM

First I thought maybe my PHP version was hacked, so I stopped. I started thinking, maybe I have just worked too much and am seeing non-sense now. Maybe a short-circuit in my brain?

I fixed a few other errors then shut down for the night.

The next day, the error was no where to be found. I couldn't replicate it and couldn't remember the exact wording to google it. Was it a dream? or Brain damage? I thought I was the only one who ever encountered this problem.

Months went by before I encountered this error again. When it happened, I was more excited seeing it then fixing my code. I pinpointed the exact line that caused it and took some notes.

I wasn't crazy. PHP was indeed expecting T_PAAMAYIM_NEKUDOTAYIM. WTF?

What it really means is 'double colon' ::. The double colon in PHP and many other languages is used for scope resolution. So I was missing the double colon and PHP was kindly reminding me. Except it did so in Hebrew.

In newer versions of PHP (5.4+) the error was updated to:

Syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)

At least now it is a little more clarified. I understand that it might have been added as a joke, and it was funny. But I can't imagine if I was struggling to fix a bug and I couldn't find any documentation to what this meant. Errors are feedback, and if they can't give you any insight of what they mean, they might as well not exist.

At least now, no matter what the language or code we see in our errors, we have the luxury of googling it and find a nice answer on stackoverflow.

Resource:


Comments

There are no comments added yet.

Let's hear your thoughts

For my eyes only