Earlier quoted context omitted.
As in defined outside of any class, object, or interface? PHP has a million of those and people write their own that way all the time. Everything is certainly not a reference and constants exist. Are you just talking about some narrow subset of PHP used in some frameworks?
I feel like your reply needs a little more context. Is the first part of responding to my claim of "effectively no top level functions"? If so, my response is that no public code seems to use them and they're much more of a pain in the butt to use because the PSR-whatever autoloader stuff only picks up classes. It's way more idiomatic to write static methods on a class- exactly like Java. "Everything" is a reference…
25 Years of PHP
271–280 of 426 posts
Re: 25 Years of PHP
#272Earlier quoted context omitted.
The parent comment to mine, though, said: > No one is claiming that PHP is and/or was without fault. I'm emphasizing the "is" part. "No one is claiming that PHP is without fault." My comment is asserting that there are definitely people who say that PHP is not bad. I did not speak to whether anyone claims PHP was never bad.
Well let's be clear ... "bad" is a little more subjective than "faults," which can at least be qualified. By some measure, every language has warts. PHP in 2008 had a ton of them. PHP in 2020 has fewer of them. Which is a lot like JS.
Re: 25 Years of PHP
#273Earlier quoted context omitted.
> One thing that still sucks is package management / composer What about Composer? Sure is in par with Slack when it comes to memory usage, bit it's functional and feature rich. v2 has partial offline support, faster downloads, etc. ( https://php.watch/articles/composer-2 ). Composer IMHO is one of the best dependency managers for any language out there. Disclaimer: the link above is a for a site I maintain.
composer is so slow tbh. It takes ages to download package and well requires me to setup swap even when i have 4 gb ram in server.
Re: 25 Years of PHP
#274Earlier quoted context omitted.
I mean, who uses mysql_real_escape_string when you have PDO and bindings ? PHP isn’t perfect. As OP said, no language is, and any competent software engineer uses the parts of the language that work well for them, and just ignores the things that don’t work for them. I don’t believe for a second that the abuse the language has suffered over the years has anything to do with mysql_real_escape_string, it’s more to do w…
> I mean, who uses mysql_real_escape_string when you have PDO and bindings ? You've made my point. A person with tribal knowledge probably would NOT. Any new user coming from reading an older blog post or perhaps a PHP book would have no idea that that "older approach" is out of date. Furthermore, the more precise point I was trying to make there was as a language designer, how on earth would you be okay implementing…
Many of the PHP extensions are direct exposure to underlying libraries. MySQL introduced a 'real escape string' in their client library, PHP exposed that directly. Had they ignored it, or renamed it, or changed param order, people would have complained about that too, no?
> Any new user coming from reading an older blog post or perhaps a PHP book would have no idea that that "older approach" is out of date
You could mostly get that from going to the PHP doc site itself, which would indicate things that are deprecated. Or your IDE might tell you.
Or, for things that are really out of date, like mysql_real_escape_string, they simply ... aren't in the language any more, having been removed completely from PHP7 several years ago. If someone is starting brand new today using a blog post walking them through setting up PHP5... they'll have much bigger problems.
There's a shitload of 'tribal knowledge' around stuff in many languages - you find out a lot of that stuff via searching. If I read an 'older blog post' on Go from 2015, and complained that my Go didn't work very well (or was insecure, or whatever), how much blame should the language itself take?
Re: 25 Years of PHP
#275I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…
> Stuff that's in comments SHOULD NOT AFFECT RUNNING CODE. To clarify, comments never affect running code in PHP, ever. What's often done however is that tools like ORMs, or web frameworks offer a 'compile' step that parses these annotations (just like it's common in Java) and dumps a PHP file that maps things in the annotations into actual PHP code. For example, you can use it in Symfony to wire routes to handling f…
I distinctly remember writing a project in PHP that allowed users to create custom reports and flows based on values returned from the data models, and for whatever reason we decided to use PHPDoc tags to determine what routines would be exposed to the public for use in these tools. We of course eventually updated this to use DB definitions instead because it was an asinine idea to need to parse a bundle of models and other files every time you needed to pull in definitions.
Re: 25 Years of PHP
#276Earlier quoted context omitted.
Well, it was episode I, which of course was the 4th film.
It's not which verion of Star Wars you worked on in what year, it's that you're choosing to defend mysql_real_escape_string, and the culture that produced and maintained and evangelized it. What you've so brilliantly and unwittingly illustrated here is that PEOPLE MAKE MISTAKES. And that contradicts your argument that attempts to shift the blame for PHP's footguns like mysql_real_escape_string onto "crappy coders" in…
Anyway, I don't care enough about what you're going on about to spend the effort arguing with you - it seems like you just want to argue, so how about we say "you win" and move on.
Re: 25 Years of PHP
#277Earlier quoted context omitted.
Your response is almost exactly the same as waheoo's. Please see my reply to his for everything you asked here.
Yeah, I noticed after I'd missed your reply there the first time around. Sorry. I'm still confused about the array keys though. I'm not sure I understand the example you gave in your other comment. And I'm also curious which Apache and Nginx has PHP installed and enabled by default.
And, you're right, of course that Apache and Nginx don't actually support PHP out of the box. It's been a bit since I've configured a server and I forgot that mod_php is an extra step. That is definitely the main "pro" to using PHP, though- the deployment is great and so easy I can literally forget it. ;)
Re: 25 Years of PHP
#278Earlier quoted context omitted.
> PHP's low entry barrier is a blessing That's the error.
What's up with that elitist attitude? Are you saying that people shouldn't be able to write code unless they've first how to do it properly?
Academic journals, book publishers, Linux distributions do vetting.
Reputable journals, publishers, distros are more strict than non-reputable ones.
Universities do exams. Companies do interviews.
Why is it acceptable that some software communities have zero standards?
Re: 25 Years of PHP
#279Earlier quoted context omitted.
It's not which verion of Star Wars you worked on in what year, it's that you're choosing to defend mysql_real_escape_string, and the culture that produced and maintained and evangelized it. What you've so brilliantly and unwittingly illustrated here is that PEOPLE MAKE MISTAKES. And that contradicts your argument that attempts to shift the blame for PHP's footguns like mysql_real_escape_string onto "crappy coders" in…
Um, I'm not defending mysql_real_escape_string. I'm not sure how you got that from what I wrote. I was saying use PDO. Anyway, I don't care enough about what you're going on about to spend the effort arguing with you - it seems like you just want to argue, so how about we say "you win" and move on.
"I don't care" is Rasmus Lerdorf's attitude about security, software quality, programming, computer science, and unit tests, which is my point. mysql_real_escape_string is just a symptom that you're brushing aside and ignoring of the real problem you're in denial of, but guilty of yourself, which is systemic CARELESSNESS.
"We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I DON'T CARE about this crap at all." -Rasmus Lerdorf
"I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but you're leaking memory everywhere. Perhaps we should fix that. I'll just restart Apache every 10 requests." -Rasmus Lerdorf
"PHP is about as exciting as your toothbrush. You use it every day, it does the job, it is a simple tool, so what? Who would want to read about toothbrushes?" -Rasmus Lerdorf
"I actually hate programming, but I love solving problems." -Rasmus Lerdorf
"I don't know how to stop it, there was never any intent to write a programming language [...] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way." -Rasmus Lerdorf
"When the world becomes standard, I will start caring about standards." -Rasmus Lerdorf
"I don't like programming. It's tedious." -Rasmus Lerdorf
Re: 25 Years of PHP
#280Earlier quoted context omitted.
Every time there's a story about PHP there's a comment like yours, and then in reply there's a comment like mine: Yes it's perfectly fine to use PHP if it's a productive environment for you. Of course it's possible to write good software with it. Of course a skilled developer will manage to do great things with sub-standard tools. Many extremely popular websites were and even still are powered by PHP, that's undeniab…
> But that doesn't mean that we should absolve PHP of all its many, many design errors over the years. There were for a long time many fundamental issues with PHP as a language that didn't exist with its peers. The language was not so much designed as it was cobbled together by amateurs starting from a half-backed templating engine. Your entitled, holier-than-thou tone here is not welcome. You must have never created…
[1] https://news.ycombinator.com/newswelcome.html
[2] https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...
[3] https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...