281
PHP Moment (lemmy.world)
submitted 2 months ago by devilish666 to c/[email protected]
top 30 comments
sorted by: hot top controversial new old
[-] [email protected] 94 points 2 months ago* (last edited 2 months ago)

Tell me you've never used PHP without telling me you've never used PHP.

It's known for giving a complete stack trace, it's nearest neighbours and their god damn grandkids the moment it so much as coughs up a warning. For the longest time it was notorious for doing this as the default error logging level.

I'm aware it's cool to hate on PHP, but it has plenty of things to dislike without straight-up inventing nonsense.

[-] [email protected] 22 points 2 months ago

Also that table would be generated by Xdebug, not PHP itself. PHP's traces are plain text by default. That said Xdebug is pretty good in itself, I've used it for a decade.

The stack traces are fine. You can even define a global handler for unhandled exceptions to log them, and it gives you an opportunity to also inspect every value of every function argument and whatnot. It's not lacking in debugging abilities that way.

If you're gonna make fun of PHP errors, at least make fun of "PHP Error: Unexpected T_PAAMAYIM_NEKUDOTAYIM on line 69".

[-] hakunawazo 10 points 2 months ago* (last edited 2 months ago)

For those not in the know, the T_PAAMAYIM_NEKUDOTAYIM is just a double colon like this ::
It's a scope resolution operator for example to directly access a class constant or method without an instance.

[-] [email protected] 3 points 2 months ago

And it means double colon in Hebrew, because the devs were from Israel.

[-] [email protected] 5 points 2 months ago

This. I haven’t touched PHP since 7.1 dropped, but error messages and stack traces were pretty far down my list of complaints about the language.

[-] [email protected] 3 points 2 months ago

PHP stack traces are effectively identical to Java's in every metric I'm concerned about.

If you get them sensibly in a log file, anyway. If you allow PHP to render this god awful fugly table inline with your page? Well, have fun. Yes, all the same info is there, and on paper it's organized in an easier to read format. But oftentimes the table will collide with and mangle with other elements and styling on your page, making the trace irritating or impossible to read.

This isn't much of a problem of course, because aforementioned log file is absolutely the way to do it in the first place, and PHP lets you. And hey, absolutely obliterating your page DOM in strange and exciting ways on error sounds like a fantastic way to ensure errors get caught and addressed in testing, so even the unpredictable mangled DOM bullshit is useful in its own way.

But if someone wants to dunk on PHP for at least outwardly appearing to promote trying to debug it with these awful stack trace tables, I think that's a well-earned roasting.

[-] devfuuu -1 points 2 months ago

I liked when it screamed at me some german error message out of nowehere or some other weird language. Totally sane language.

[-] [email protected] 29 points 2 months ago

So many people don’t know how to use PHP

[-] eager_eagle 22 points 2 months ago

nice stack traces don't matter when PHP has the best built-in name: die()

[-] [email protected] 3 points 2 months ago

die unless qw(perl did it first);

[-] [email protected] 16 points 2 months ago* (last edited 2 months ago)

While this is very funny, I think with PHP you can achieve error traces like in Java, nowadays. And no, I am (not) a senior PHP developer. ^^

Edit: I used PHP-4 ages ago and now I am relearning >=PHP-8. Not sure whether junior or senior.

[-] TCB13 11 points 2 months ago

Only if people actually tried to learn PHP.

[-] desmosthenes 9 points 2 months ago
[-] [email protected] 18 points 2 months ago
[-] Potatos_are_not_friends 4 points 2 months ago

My favorite (and by favorite I mean most painful) joke is someone submitting [object Object] as a string and panicking for hours wondering where in the JS that did that.

[-] [email protected] 8 points 2 months ago

Rust: Here's an explanation of what you did wrong, where you did it, and a detailed wiki page about the subject

[-] [email protected] 8 points 2 months ago

Having written PHP for many years, all I have to say about it is T_PAAMAYIM_NEKUDOTAYIM

[-] [email protected] 1 points 2 months ago
[-] lawrence 4 points 2 months ago
[-] [email protected] 2 points 2 months ago

I salute you.

But which version?

[-] [email protected] 3 points 2 months ago

Maybe wrong place to ask idk lol, but I wanted to create a wiki clone to learn more complex websites with a database. Im a bit lost trying to learn Laravel from the ground, anyone knows where can I start? Maybe some tried and true helpful resource?

[-] Potatos_are_not_friends 2 points 2 months ago

Laracasts made me love frontend again.

[-] captainjaneway 2 points 2 months ago

They probably have tutorials on their website. Most MVC frameworks have pretty decent guides.

[-] lawrence 2 points 2 months ago* (last edited 2 months ago)

Laravel from Scratch is the best Laravel course available. It is free and was created by the founder of Laracasts. This tutorial series covers all the important features of the framework from beginning to end. Although it's for Laravel 8 and not 10, all the knowledge you gain from this course you can and should be applied to Laravel 10.

[-] [email protected] 1 points 2 months ago

Progress errors be like: "I can't understand after line 32"

Good luck finding out what

[-] Clbull 1 points 2 months ago

Isn't Java known for spitting out random errors?

[-] [email protected] 7 points 2 months ago
[-] [email protected] 1 points 1 month ago* (last edited 1 month ago)

php is great and all but the thing that makes it utter bullshit is that if even one little thing is wrong, the thing simply stops running and it's up to you to make print statements for fucking everything. This is only sustainable if you're troubleshooting your own code. If you want to fix someone else's broken php program then forget about it.

this post was submitted on 28 Feb 2024
281 points (92.2% liked)

Programmer Humor

30779 readers
159 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 4 years ago
MODERATORS