subreddit
stringclasses
7 values
author
stringlengths
3
20
id
stringlengths
5
7
content
stringlengths
67
30.4k
score
int64
0
140k
lolphp
Various_Pickles
dad8qrp
<|sols|><|sot|>Opencart, a PHP-based e-commerce platform, will expose DB passwords to users if the MySQL server is down and error reporting hasn't been turned off<|eot|><|sol|>https://github.com/opencart/opencart/issues/5027<|eol|><|sor|>> oh shit i cant talk to the db hunter2 hunter2 hunter2!<|eor|><|eols|><|endoftext|>
5
lolphp
marcini82
daasbb1
<|sols|><|sot|>Opencart, a PHP-based e-commerce platform, will expose DB passwords to users if the MySQL server is down and error reporting hasn't been turned off<|eot|><|sol|>https://github.com/opencart/opencart/issues/5027<|eol|><|sor|>But where is the lolphp in this case?<|eor|><|eols|><|endoftext|>
5
lolphp
berkes
dab62t4
<|sols|><|sot|>Opencart, a PHP-based e-commerce platform, will expose DB passwords to users if the MySQL server is down and error reporting hasn't been turned off<|eot|><|sol|>https://github.com/opencart/opencart/issues/5027<|eol|><|sor|>But where is the lolphp in this case?<|eor|><|sor|>> Error No: ' in /home/user/domain/system/library/db/mysqli.php:10 Stack trace: #0 /home/user/domain/system/library/db.php(9): DB\MySQLi->__construct('localhost', 'opencart', 'pass123', 'opencart', '3306') It's also filled with a lot of loldevelopers in the thread, arguing that it's ok to output source code "because error reporting should be disabled"<|eor|><|sor|>I'm not a PHP dev, but I know that if you run any Django or Flask app in debug mode it will do the exact same thing. Sounds like PHP error reporting is the equivalent of that setting. So this seems like more of a case of "lol code deployment" more than lolphp.<|eor|><|sor|>> but I know that if you run any Django or Flask app in debug mode it will do the exact same thing. Are you sure? I've done lots of both and I don't remember any credentials being dumped in a stack trace. Not trying to be antagonistic here, just maybe I missed it?<|eor|><|sor|>It seems I'm only partially right. It seems that Django's [debug mode](https://docs.djangoproject.com/en/1.10/ref/settings/#debug) stack traces do their best to filter out variables with names that may include secret info. But they do dump a huge trace with the ability to read any variable that doesn't match their "sensitive" patterns. They warn to *never* deploy with debug on because there are still terrible things that can be done with such info. Flask's [debug mode](http://flask.pocoo.org/docs/0.11/quickstart/#debug-mode) in their development server has a full REPL, so you can execute arbitrary code in it. Although, this would be much harder to "accidentally" deploy because most deployed Flask apps are behind a UWSGi gateway and wouldn't be using the development server to begin with. All that said, in many deployment scenarios, a database password would be harmless, because the database server can be configured to only accept connections locally (if on the same machine) or within the site's private network. I've seen deployment scenarios where there is no password thanks to this. TL;DR Programming and deployment is complicated and you need to know what you're doing regardless of whether you're using Python or PHP.<|eor|><|sor|>Comparable: Rails, in development environment will return all sorts of fancy data with exceptions. And while by default it tries to excelude attributes like "password" from logs and exceptions, it is not hard to get data like session-ids or entire cookies in the exceptions. In your *development* environment. But. Rails is a framework of defaults (convention over configuration). So: sure, with some tweaking and tuning -some effort- you'll be able to enable this on production too. But you really need to do some effort, because without spending that time and effort, you'll get a secure implementation: where an exception results in a very generic and uninformative 500-error. And where passwords and other such details are never logged. The lolphp is not so much PHP, but more a culture surrounding PHP where one *has to do additional work* to make the application secure, instead of being secure by default and requiring additional work to make it insecure.<|eor|><|eols|><|endoftext|>
5
lolphp
disclosure5
2og776
<|sols|><|sot|>When your only major crypto library hasn't been maintained since 2007<|eot|><|sol|>http://news.php.net/php.internals/79446<|eol|><|eols|><|endoftext|>
65
lolphp
ZugNachPankow
cmmutbx
<|sols|><|sot|>When your only major crypto library hasn't been maintained since 2007<|eot|><|sol|>http://news.php.net/php.internals/79446<|eol|><|sor|>[deleted]<|eor|><|sor|>\>md5 \>encryption lel^I ^know, ^it ^was ^the ^joke. <|eor|><|eols|><|endoftext|>
18
lolphp
nikic
cmmv6mb
<|sols|><|sot|>When your only major crypto library hasn't been maintained since 2007<|eot|><|sol|>http://news.php.net/php.internals/79446<|eol|><|sor|>Mcrypt is not PHPs "only major crypto library", it also has openssl bindings. (Which are often recommended over mcrypt for the very mundane reason of being a good bit faster).<|eor|><|eols|><|endoftext|>
17
lolphp
disclosure5
cmmvgbr
<|sols|><|sot|>When your only major crypto library hasn't been maintained since 2007<|eot|><|sol|>http://news.php.net/php.internals/79446<|eol|><|sor|>Mcrypt is not PHPs "only major crypto library", it also has openssl bindings. (Which are often recommended over mcrypt for the very mundane reason of being a good bit faster).<|eor|><|soopr|>On a Google for "PHP encrypt", the first six hits are about mcrypt, and two on the first page refer to "pure php" implementations that no one would ever use. It actually seemed quite hard to find anyone in PHP land using OpenSSL over mcrypt. [In this discussion](http://laravel.io/forum/08-28-2014-replace-mcrypt-with-openssl-in-encrypter-class) we can see references to the performance of mcrypt being an issue within Laravel, which seems to be the most commonly recommended framework over in /r/php. It sure does exist, and it's sure usable, and if that suits your definition of "major" then so be it. As a side note, calling MCRYPT_RIJNDAEL_128 because you want AES-256 seems like a lolphp itself. Yes, I know Rijndael can take variable block sizes and I get it, you want the 128 bit edition to make it AES. But given every developer and his dog wants AES-256, that "128" sitting there is silly.<|eoopr|><|eols|><|endoftext|>
12
lolphp
nikic
cmmwk99
<|sols|><|sot|>When your only major crypto library hasn't been maintained since 2007<|eot|><|sol|>http://news.php.net/php.internals/79446<|eol|><|sor|>Mcrypt is not PHPs "only major crypto library", it also has openssl bindings. (Which are often recommended over mcrypt for the very mundane reason of being a good bit faster).<|eor|><|soopr|>On a Google for "PHP encrypt", the first six hits are about mcrypt, and two on the first page refer to "pure php" implementations that no one would ever use. It actually seemed quite hard to find anyone in PHP land using OpenSSL over mcrypt. [In this discussion](http://laravel.io/forum/08-28-2014-replace-mcrypt-with-openssl-in-encrypter-class) we can see references to the performance of mcrypt being an issue within Laravel, which seems to be the most commonly recommended framework over in /r/php. It sure does exist, and it's sure usable, and if that suits your definition of "major" then so be it. As a side note, calling MCRYPT_RIJNDAEL_128 because you want AES-256 seems like a lolphp itself. Yes, I know Rijndael can take variable block sizes and I get it, you want the 128 bit edition to make it AES. But given every developer and his dog wants AES-256, that "128" sitting there is silly.<|eoopr|><|sor|>Not sure why calling a cipher by the correct name is a lolphp, only because many people implementing crypto code are absolutely ignorant of the topic. (Sadly this is not just limited to using the wrong cipher, most of the simple symmetric crypto code that I've seen contains about 3-5 severe mistakes.)<|eor|><|eols|><|endoftext|>
12
lolphp
ZugNachPankow
cmnocmb
<|sols|><|sot|>When your only major crypto library hasn't been maintained since 2007<|eot|><|sol|>http://news.php.net/php.internals/79446<|eol|><|sor|>[deleted]<|eor|><|sor|>\>md5 \>encryption lel^I ^know, ^it ^was ^the ^joke. <|eor|><|sor|>nice meme arrows ;\^)<|eor|><|sor|>Meh. I find "le memearrows" to be a concise format for what I intend to communicate, and employ them. I don't really see the point in hating them. <|eor|><|eols|><|endoftext|>
5
lolphp
vytah
2j8i3g
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|eols|><|endoftext|>
67
lolphp
Regimardyl
cl9jiki
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>PHP Quantum physics again; introspecting something changes it's value. ^(Not my joke, found it somewhere here)<|eor|><|eols|><|endoftext|>
37
lolphp
midir
cl9zl8t
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>When is an immutable object not immutable? When you look at it.<|eor|><|eols|><|endoftext|>
10
lolphp
OneWingedShark
cl9v7qy
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>You would think that the person or the persons involved in designing a class named fucking DateTime**IMMUTABLE** would design it in a way that makes it behave as the name implies: to not change over time. I guess I was wrong - but then again, at my workplace we create two instances of a class named ABCSingleton (censored to not implicate my company :P) because highlander was fucking wrong - there cannot be only one...<|eor|><|sor|>> we create two instances of a class named ***ABCSingleton*** (censored to not implicate my company :P) because highlander was fucking wrong - there cannot be only one... You really work at ABC, don't you? ;)<|eor|><|eols|><|endoftext|>
8
lolphp
killerstorm
cl9xb94
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>To quote the documentation for DateTimeImmutable::modify: Creates a new DateTimeImmutable object with modified timestamp. The original object is not modified. IS NOT MODIFIED. It generates a new object, it does not modify the original one. I don't understand the lolphp? (This behaves differently to normal DateTime which does return the same DateTime object when modifying it.) Seems immutable to me. The only people who this would be mutable are those who cannot even be bothered to open the documentation, and instead post everything they see.<|eor|><|sor|>Try reading the title again, it is not about ::modify()<|eor|><|eols|><|endoftext|>
7
lolphp
vytah
cl9c3ec
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|soopr|>Another submission of the same bug: https://bugs.php.net/bug.php?id=68204<|eoopr|><|eols|><|endoftext|>
6
lolphp
mort96
cla0dw0
<|sols|><|sot|>How to modify DateTimeImmutable? Call getTimestamp() on it.<|eot|><|sol|>https://bugs.php.net/bug.php?id=67634<|eol|><|sor|>PHP Quantum physics again; introspecting something changes it's value. ^(Not my joke, found it somewhere here)<|eor|><|sor|>> it's<|eor|><|eols|><|endoftext|>
6
lolphp
dagbrown
232phg
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|eols|><|endoftext|>
65
lolphp
willfe42
cgsx11i
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>[deleted]<|eor|><|sor|>lol entitled much?<|eor|><|sor|>Heh, yeah, screw those "experts" and their fancy crypto (I mean, c'mon, they even had a _vulnerability_ recently, proving they're terrible and wrong, right?). Let's just rewrite it all natively in PHP! Then _any_ web server can do SSH, SFTP, RSA and X.509! Nothing could possibly go wrong at all, especially given PHP's much-vaunted security and reliability!<|eor|><|eols|><|endoftext|>
23
lolphp
dehrmann
cgt3rt2
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>Really, a crypto library in any language without primatives like bytes or uint64 is scary.<|eor|><|eols|><|endoftext|>
22
lolphp
bgeron
cgsyvpk
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>[deleted]<|eor|><|sor|>I think the Mt-gox owner has done a ssh server in PHP, at least this is client code.<|eor|><|sor|>https://web.archive.org/web/20140225092436/http://blog.magicaltux.net/2010/06/27/php-can-do-anything-what-about-some-ssh/ Server actually. In production, for clients.<|eor|><|eols|><|endoftext|>
20
lolphp
jmcs
cgsx5s6
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>[deleted]<|eor|><|sor|>I think the Mt-gox owner has done a ssh server in PHP, at least this is client code.<|eor|><|eols|><|endoftext|>
13
lolphp
ebol4anthr4x
cgtgahe
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>Really, a crypto library in any language without primatives like bytes or uint64 is scary.<|eor|><|sor|>We're gonna see vulnerabilities based on the type system, I guarantee it. Special values where arithmetic operators don't do what you'd expect them to, that kind of stuff.<|eor|><|sor|>Only kinda related, but there was actually a Wordpress vulnerability released about a week ago that abuses the type system in PHP. https://labs.mwrinfosecurity.com/blog/2014/04/11/wordpress-auth-cookie-forgery/<|eor|><|eols|><|endoftext|>
10
lolphp
suspiciously_calm
cgta83a
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>Really, a crypto library in any language without primatives like bytes or uint64 is scary.<|eor|><|sor|>We're gonna see vulnerabilities based on the type system, I guarantee it. Special values where arithmetic operators don't do what you'd expect them to, that kind of stuff.<|eor|><|eols|><|endoftext|>
6
lolphp
captainramen
cgt6mc6
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>[deleted]<|eor|><|sor|>I think the Mt-gox owner has done a ssh server in PHP, at least this is client code.<|eor|><|sor|>https://web.archive.org/web/20140225092436/http://blog.magicaltux.net/2010/06/27/php-can-do-anything-what-about-some-ssh/ Server actually. In production, for clients.<|eor|><|sor|>Too bad people trusted PHP with their bitcoin.<|eor|><|eols|><|endoftext|>
6
lolphp
graingert
cgvn57l
<|sols|><|sot|>Pure PHP implementations of SSH, SFTP, RSA and X.509--I don't see how that could possibly go wrong<|eot|><|sol|>http://phpseclib.sourceforge.net<|eol|><|sor|>Is this a piece of performance art?<|eor|><|eols|><|endoftext|>
5
lolphp
allthediamonds
1v7ek6
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|eols|><|endoftext|>
69
lolphp
merreborn
cepff7f
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|eols|><|endoftext|>
23
lolphp
audaxxx
cepfqw1
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>Wat. Why? Is it somehow deciding that the number value of 'bacon' is 0 and then comparing that against the 0 in the array?<|eor|><|sor|>Yes. Because that is a good default choice.<|eor|><|eols|><|endoftext|>
20
lolphp
catcradle5
cepn7is
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|eols|><|endoftext|>
17
lolphp
BufferUnderpants
cepoijo
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>This is well documented and therefore completely logical and a sound decision that you are not allowed to criticize. If you, for some reason, would like a different equality operator that respects types, you should use `===`, which means that the former behavior doesn't affect you, ever. Edit: guys, your sarcasm detector may as well be included in PHP's standard library.<|eor|><|eols|><|endoftext|>
17
lolphp
audaxxx
cepksh8
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>Wat. Why? Is it somehow deciding that the number value of 'bacon' is 0 and then comparing that against the 0 in the array?<|eor|><|sor|>Yes. Because that is a good default choice.<|eor|><|sor|>[deleted]<|eor|><|sor|>Because everyone in this subreddit is here to talk about how awesome PHP's decisions are.<|eor|><|sor|>A true masterpiece by a gifted language designer.<|eor|><|eols|><|endoftext|>
15
lolphp
ahruss
cepusjg
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>The same reason incrementing the string "2d9" twice yields "2e0" the first time and float(3) the second time. <|eor|><|eols|><|endoftext|>
14
lolphp
escozzia
cepf8g3
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>Wat. Why? Is it somehow deciding that the number value of 'bacon' is 0 and then comparing that against the 0 in the array?<|eor|><|eols|><|endoftext|>
13
lolphp
jellyislovely
cepo5ts
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|eols|><|endoftext|>
13
lolphp
ahruss
cepklw4
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>Wat. Why? Is it somehow deciding that the number value of 'bacon' is 0 and then comparing that against the 0 in the array?<|eor|><|sor|>Yes. Because that is a good default choice.<|eor|><|sor|>[deleted]<|eor|><|sor|>Because everyone in this subreddit is here to talk about how awesome PHP's decisions are.<|eor|><|eols|><|endoftext|>
13
lolphp
BufferUnderpants
ceq4a01
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>This is well documented and therefore completely logical and a sound decision that you are not allowed to criticize. If you, for some reason, would like a different equality operator that respects types, you should use `===`, which means that the former behavior doesn't affect you, ever. Edit: guys, your sarcasm detector may as well be included in PHP's standard library.<|eor|><|sor|>Ok, I'll bite. The default is idiotic, implicit string->int conversions are idiotic, their drawbacks far outweigh the advantages, they break the principle of least surprise and so are by definition bad design.<|eor|><|sor|>Sorry, are you using srcsm_detect? You should be using real_sarcsm_detect, everyone knows that.<|eor|><|eols|><|endoftext|>
12
lolphp
SyKoHPaTh
cepfhxh
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>Need to use TRUE for strict: if (in_array('bacon', $noBacon, TRUE)) { Since variables don't have a type, strings have a value of "0" unless they start with a number.<|eor|><|eols|><|endoftext|>
10
lolphp
n0rs
ceq0vlu
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>The same reason incrementing the string "2d9" twice yields "2e0" the first time and float(3) the second time. <|eor|><|sor|>Whaaaaat... that is a thing??? That is just....why???<|eor|><|sor|>https://eval.in/89753<|eor|><|eols|><|endoftext|>
10
lolphp
jmcs
ceq01u0
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>This is well documented and therefore completely logical and a sound decision that you are not allowed to criticize. If you, for some reason, would like a different equality operator that respects types, you should use `===`, which means that the former behavior doesn't affect you, ever. Edit: guys, your sarcasm detector may as well be included in PHP's standard library.<|eor|><|sor|>Ok, I'll bite. The default is idiotic, implicit string->int conversions are idiotic, their drawbacks far outweigh the advantages, they break the principle of least surprise and so are by definition bad design.<|eor|><|eols|><|endoftext|>
9
lolphp
merreborn
cepgnrh
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>And that's what happens when you make a hash table and an array one data type.<|eor|><|sor|>That's not really relevant. This would still happen, even if those two types were separate. This is a symptom of PHP's loose type conversion rules, specifically as it relates to comparing non-numeric strings with `(int)0`<|eor|><|eols|><|endoftext|>
8
lolphp
aaron552
cepifl7
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>Need to use TRUE for strict: if (in_array('bacon', $noBacon, TRUE)) { Since variables don't have a type, strings have a value of "0" unless they start with a number.<|eor|><|sor|>Oh boy, is a string literal a variable in PHP? That sounds *exactly* like PHP.<|eor|><|eols|><|endoftext|>
7
lolphp
TheGreatFohl
ceq0m1i
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>The same reason incrementing the string "2d9" twice yields "2e0" the first time and float(3) the second time. <|eor|><|sor|>Whaaaaat... that is a thing??? That is just....why???<|eor|><|eols|><|endoftext|>
7
lolphp
midir
ceq1te5
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>This is well documented and therefore completely logical and a sound decision that you are not allowed to criticize. If you, for some reason, would like a different equality operator that respects types, you should use `===`, which means that the former behavior doesn't affect you, ever. Edit: guys, your sarcasm detector may as well be included in PHP's standard library.<|eor|><|sor|>Is it also completely logical that `"9999999999999999"=="10000000000000000"` (both strings)?<|eor|><|eols|><|endoftext|>
7
lolphp
jmcs
ceq50fq
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|>[`in_array`: Searches haystack for needle using loose comparison unless strict is set.](http://php.net/in_array) `0 == 'bacon'`, but `0 !== 'bacon'`, therefor `in_array('bacon', $noBacon)`, but `!in_array('bacon', $noBacon, $strict=true)`<|eor|><|sor|>I really don't understand why `0 == 'bacon'` in the first place, even if you consider the craziest definitions of "loose comparison". `0` is `false` or falsy, `'bacon'` clearly is not falsy, so why would they be loosely equal? `'' == 0` makes sense, but other strings don't.<|eor|><|sor|>It's because of how PHP interprets strings to integers. For example '100' is converted to 100. Since there is no number in 'bacon' it is interpreted as 0.<|eor|><|sor|>This is well documented and therefore completely logical and a sound decision that you are not allowed to criticize. If you, for some reason, would like a different equality operator that respects types, you should use `===`, which means that the former behavior doesn't affect you, ever. Edit: guys, your sarcasm detector may as well be included in PHP's standard library.<|eor|><|sor|>Ok, I'll bite. The default is idiotic, implicit string->int conversions are idiotic, their drawbacks far outweigh the advantages, they break the principle of least surprise and so are by definition bad design.<|eor|><|sor|>Sorry, are you using srcsm_detect? You should be using real_sarcsm_detect, everyone knows that.<|eor|><|sor|>Sorry, I used to work and regularly deal with the kind of... "special people" that worships Rasmus and will say far worse stuff to justify his "holy works". I guess I need a really_real_sarcsm_detect because the other ones broke long ago when we are talking about PHP.<|eor|><|eols|><|endoftext|>
7
lolphp
barubary
cephfk7
<|sols|><|sot|>In which in_array() does crazy stuff<|eot|><|sol|>https://eval.in/89008<|eol|><|sor|> % php -r 'var_dump(in_array(2000, array(md5("dbox"))));' bool(true)<|eor|><|eols|><|endoftext|>
6
lolphp
jamwaffles
1umksd
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|eols|><|endoftext|>
66
lolphp
jamwaffles
cejmq7o
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>There are no bugs in PHP, only features.<|eor|><|soopr|>`[ Submit New Feature Report ]` *click*<|eoopr|><|eols|><|endoftext|>
26
lolphp
ismtrn
cejl6vv
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>There are no bugs in PHP, only features.<|eor|><|eols|><|endoftext|>
25
lolphp
Lokaltog
cejlrj6
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|eols|><|endoftext|>
21
lolphp
Lokaltog
cejnxah
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|eols|><|endoftext|>
19
lolphp
poizan42
cejp3fi
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>Apparently they considered :::, :> and :) as options. Seriously guys, what the fuck? It's like they are fucking idiots on purpose. Read the IRC logs where they talk about the namespace separator. Contains gems like this: >I also believe strongly that every separator is terrible. \ is like democracy. The worst separator ever conceived except for all the other ones :) How about a single dot?! Why wasn't it even considered?!<|eor|><|sor|>> How about a single dot?! Why wasn't it even considered?! Because it's already the string concatenation operator. There would be no way of telling weather a.b meant the namespace a.b or the constant a concatenated with the constant b. Actually having a string concatenation operator is one of the few things PHP has done right IMO - whether they should have used another symbol for it is another thing. Their reasons for not using :: seems to be along the lines of "We can't be bothered with writing a sane parse, so instead we just have to introduce more insanity."<|eor|><|eols|><|endoftext|>
19
lolphp
suspiciously_calm
cejuuoz
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>Feature request: *Unfuck the language* Status: closed; wontfix<|eor|><|eols|><|endoftext|>
17
lolphp
OneWingedShark
cejshm6
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>As a younger programmer, I never understood the decision to use a \ in Windows. Was it not yet an escape character when this was decided or was it stupid on Microsoft's part?<|eor|><|sor|>> Was it not yet an escape character when this was decided or was it stupid on Microsoft's part? Nope. Early DOS was written in assembly, not C and so there were no "escape characters". Though there were $-terminated strings. IIRC.<|eor|><|eols|><|endoftext|>
11
lolphp
realnowhereman
cejss0c
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>As a younger programmer, I never understood the decision to use a \ in Windows. Was it not yet an escape character when this was decided or was it stupid on Microsoft's part?<|eor|><|sor|>it was not! > Whenever discussions of Microsoft's design choices come up nowadays, there's often this implicit assumption that Unix ruled the world and those micro weirdos flagrantly disregarded the "standard" use of backslash, signals, newlines, etc. Not true -- instead, Unix was considered a bizarre niche product. Hard to use, easy to port (if you didn't care about the details), quick to crash, and promising amazing power to those willing to grok its low-level mysteries: in short, Unix was FORTH. >It's only because C and shell scripting included so many Unix-specific assumptions ("\n denotes the end-of-line character," etc.), and they spawned so many modern programming languages from Java to Perl, that people have come to imagine that these things are so ubiquitous they must be eternal computer science principles. http://blogs.msdn.com/b/oldnewthing/archive/2008/08/06/8835317.aspx#8841279<|eor|><|eols|><|endoftext|>
10
lolphp
Rhomboid
cejuwqb
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>As a younger programmer, I never understood the decision to use a \ in Windows. Was it not yet an escape character when this was decided or was it stupid on Microsoft's part?<|eor|><|sor|>> As a younger programmer, I never understood the decision to use a \ in Windows. Well, `/` was taken! Where \*nix uses `foo -option`, DOS had `foo /option`. It was alright, DOS 1.0 didn't have directories. Then when they wanted to join the cool boys club, well, backslash is sort of like slash, right?<|eor|><|sor|>Every Microsoft operating system since DOS 2.0 has silently supported forward slash as the path separator at the filesystem API level. Certain tools like cmd.exe or command.com don't necessarily grok it, but the actual filesystem APIs do. <|eor|><|eols|><|endoftext|>
9
lolphp
limasxgoesto0
cejr08l
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>As a younger programmer, I never understood the decision to use a \ in Windows. Was it not yet an escape character when this was decided or was it stupid on Microsoft's part?<|eor|><|eols|><|endoftext|>
7
lolphp
poizan42
cejpd7t
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>I lol'd when I noticed how the *great* design decision of using \ as a namespace separator have insanely stupid side effects, like having to escape it as \\\\ every time you reference a namespace in a string like the example in one of the comments.<|eor|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>Apparently they considered :::, :> and :) as options. Seriously guys, what the fuck? It's like they are fucking idiots on purpose. Read the IRC logs where they talk about the namespace separator. Contains gems like this: >I also believe strongly that every separator is terrible. \ is like democracy. The worst separator ever conceived except for all the other ones :) How about a single dot?! Why wasn't it even considered?!<|eor|><|sor|>> How about a single dot?! Why wasn't it even considered?! Because it's already the string concatenation operator. There would be no way of telling weather a.b meant the namespace a.b or the constant a concatenated with the constant b. Actually having a string concatenation operator is one of the few things PHP has done right IMO - whether they should have used another symbol for it is another thing. Their reasons for not using :: seems to be along the lines of "We can't be bothered with writing a sane parse, so instead we just have to introduce more insanity."<|eor|><|sor|>It would just require a bit of lookahead to implement. Well, lookahead in PHP's lexical analyzer is probably impossible ...<|eor|><|sor|>For the dot? No. Simple statement: echo a.b; Is that the constant a concatenated with the constant b or the constant b in the namespace a?<|eor|><|eols|><|endoftext|>
6
lolphp
jamwaffles
cejvzr3
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>Feature request: *Unfuck the language* Status: closed; wontfix<|eor|><|soopr|>Status: bug.<|eoopr|><|eols|><|endoftext|>
5
lolphp
poizan42
cejt6vp
<|sols|><|sot|>Bugs are just feature requests, apparently<|eot|><|sol|>https://bugs.php.net/bug.php?id=63359&edit=1<|eol|><|sor|>Why couldn't they use a dot like any other language? Seriously, backslashes as namespace separators are the last nail in PHP 's coffin. <|eor|><|sor|>Yeah, I actually quit PHP after I read the dev discussion IRC log regarding ns separators. IIRC they decided on \ because it's familiar to windows users, and because Nordic keyboards don't require a shift-click to insert a backslash. I nope'd right out of PHP, quit my job and learned python the following months and don't regret it at all. They decided against dots for some weird reason too, like an edge case scenario where you want to access a specific namespace variable from a static function in an instantiated class or something like that. Haha, and one of the suggestions they considered was :) or a similar smiley. Yes, they really are that incompetent. Edit: source: https://wiki.php.net/rfc/namespaceseparator<|eor|><|sor|>Apparently they considered :::, :> and :) as options. Seriously guys, what the fuck? It's like they are fucking idiots on purpose. Read the IRC logs where they talk about the namespace separator. Contains gems like this: >I also believe strongly that every separator is terrible. \ is like democracy. The worst separator ever conceived except for all the other ones :) How about a single dot?! Why wasn't it even considered?!<|eor|><|sor|>> How about a single dot?! Why wasn't it even considered?! Because it's already the string concatenation operator. There would be no way of telling weather a.b meant the namespace a.b or the constant a concatenated with the constant b. Actually having a string concatenation operator is one of the few things PHP has done right IMO - whether they should have used another symbol for it is another thing. Their reasons for not using :: seems to be along the lines of "We can't be bothered with writing a sane parse, so instead we just have to introduce more insanity."<|eor|><|sor|>It would just require a bit of lookahead to implement. Well, lookahead in PHP's lexical analyzer is probably impossible ...<|eor|><|sor|>For the dot? No. Simple statement: echo a.b; Is that the constant a concatenated with the constant b or the constant b in the namespace a?<|eor|><|sor|>How about this? echo 1.2; # prints 1.2 echo 1 . 2; # prints 12 The dot somehow also manages to work as a decimal "operator", so it does do more than one thing. Haskell is also capable of using a dot for both referencing stuff in modules and composing functions: let f = Data.Set.fromList . map Data.Char.toUpper :t f f :: [Char] -> containers-0.5.0.0:Data.Set.Base.Set Char f "hello" fromList "EHLO" though you'll need spaces, like with the `1 . 2` example above.<|eor|><|sor|>While it does it would lead to some serious breakage of existing code. And then, what should a.b mean? Should a.b be the namespace and a . b be the concatenation? Making required whitespace a part of the syntax in arbitrary places seems like a thing you would want to avoid. At least in the 1.2 vs. 1 . 2 case you don't have any real world use for concatenating numbers literals when you could just have written '12' instead.<|eor|><|eols|><|endoftext|>
5
lolphp
catcradle5
1sir7f
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|eols|><|endoftext|>
71
lolphp
kmeisthax
cdy00x8
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|sor|>extract: Because there isn't any other way to handle associative arrays, like say, a convenient operator syntax. NOPE GOTTA POLLUTE THE SYMBOL TABLE<|eor|><|eols|><|endoftext|>
21
lolphp
catcradle5
cdxzj8q
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|soopr|>I know the second note and warning are about using it in conjunction with `register_globals`, but I find this humorous if only because of how PHP provides so many ways to munge the namespace by magically turning everything into a variable.<|eoopr|><|eols|><|endoftext|>
17
lolphp
_vec_
cdyc3tf
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|sor|>So this function is a sharp knife with a broken handle (the `EXTR_SKIP` option is mandatory and should be the default), but I have actually seen a non-insane use for this: template rendering. function render ($template, $data = array()) { extract($data, EXTR_SKIP); include TEMPLATE_DIR . $template; } Lets you pass an array to the template and the keys get vivified into local variables in the view context only. Admittedly, this only works because of the, er, interesting way that PHP handles scoping included files, but it can go a long way toward creating readable view templates.<|eor|><|eols|><|endoftext|>
8
lolphp
_vec_
cdyj562
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|sor|>So this function is a sharp knife with a broken handle (the `EXTR_SKIP` option is mandatory and should be the default), but I have actually seen a non-insane use for this: template rendering. function render ($template, $data = array()) { extract($data, EXTR_SKIP); include TEMPLATE_DIR . $template; } Lets you pass an array to the template and the keys get vivified into local variables in the view context only. Admittedly, this only works because of the, er, interesting way that PHP handles scoping included files, but it can go a long way toward creating readable view templates.<|eor|><|sor|>Yeah, but you don't need a function to do that: function render ($template, $data = array()) { foreach ($data as $__key__ => $__val__) { if (!isset($$__key__)) $$__key__ = $__val__; } include TEMPLATE_DIR . $template; } The existence of a function is just begging people to abuse it.<|eor|><|sor|>True, but if we're talking about dumping language misfeatures I'd much rather remove variable variables than `extract()`.<|eor|><|eols|><|endoftext|>
7
lolphp
poizan42
cdyf7at
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|sor|>So this function is a sharp knife with a broken handle (the `EXTR_SKIP` option is mandatory and should be the default), but I have actually seen a non-insane use for this: template rendering. function render ($template, $data = array()) { extract($data, EXTR_SKIP); include TEMPLATE_DIR . $template; } Lets you pass an array to the template and the keys get vivified into local variables in the view context only. Admittedly, this only works because of the, er, interesting way that PHP handles scoping included files, but it can go a long way toward creating readable view templates.<|eor|><|sor|>Yeah, but you don't need a function to do that: function render ($template, $data = array()) { foreach ($data as $__key__ => $__val__) { if (!isset($$__key__)) $$__key__ = $__val__; } include TEMPLATE_DIR . $template; } The existence of a function is just begging people to abuse it.<|eor|><|eols|><|endoftext|>
6
lolphp
_vec_
cdymbxx
<|sols|><|sot|>Warning: Note: Warning: Do not use this, ever!<|eot|><|sol|>http://www.php.net/manual/en/function.extract.php#refsect1-function.extract-notes<|eol|><|sor|>There's one instance in which I will use extract(). That is in a template rendering function. As long as the function does nothing but extract the variables and then include the template file (which should NOT contain logic), you don't risk polluting namespace and you get easier access to data from within the templates. <h1><?php echo $title ?></h1> <p><?php echo $content ?></p> instead of <h1><?php echo $data['title'] ?></h1> <p><?php echo $data['content'] ?></p> <|eor|><|sor|>Should really use `<?= $title ?>` for maximum readability. It's not really clear from the docs, but since PHP 5.4 even when normal short tags are disabled the echo version works.<|eor|><|eols|><|endoftext|>
5
lolphp
LongDistanceEjcltr
8cndje
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|eols|><|endoftext|>
67
lolphp
andsens
dxg9l0j
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>Haha, wat indeed. [I figured it out](https://3v4l.org/X3kb4). Somewhere the element is type coerced into an integer.<|eor|><|eols|><|endoftext|>
25
lolphp
fell_ratio
dxgdv0r
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>Haha, wat indeed. [I figured it out](https://3v4l.org/X3kb4). Somewhere the element is type coerced into an integer.<|eor|><|sor|>Now we just wait for someone to comment that this is the documented behavior of simplexml.<|eor|><|eols|><|endoftext|>
22
lolphp
FlyLo11
dxgiuec
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>Haha, wat indeed. [I figured it out](https://3v4l.org/X3kb4). Somewhere the element is type coerced into an integer.<|eor|><|sor|>It happens during division: https://3v4l.org/VFo9o where it tries to convert the object to int instead of float for some reason. And it seems that PHP knows how to convert SimpleXMLElement objects to int, as opposed to userland objects, which are treated as `1`. This is indeed a funny wat.<|eor|><|eols|><|endoftext|>
17
lolphp
human_bacon
dxhzsvb
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>So I did some digging before filing a bug report, turns out this is a known bug and shall be fixed in php 7.3 https://bugs.php.net/bug.php?id=54973 https://github.com/php/php-src/blob/b2b2b437af5495dcb2016be6e45567ed826cb87e/NEWS#L140 But of course, the first reply to the bug report is "This is not a bug"<|eor|><|eols|><|endoftext|>
12
lolphp
polish_niceguy
dxi1e9z
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>So I did some digging before filing a bug report, turns out this is a known bug and shall be fixed in php 7.3 https://bugs.php.net/bug.php?id=54973 https://github.com/php/php-src/blob/b2b2b437af5495dcb2016be6e45567ed826cb87e/NEWS#L140 But of course, the first reply to the bug report is "This is not a bug"<|eor|><|sor|>And it took only six years to fix.<|eor|><|eols|><|endoftext|>
7
lolphp
UnusualBear
dxmqy83
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>Haha, wat indeed. [I figured it out](https://3v4l.org/X3kb4). Somewhere the element is type coerced into an integer.<|eor|><|sor|>That's such ridiculous behavior. Why in gods name would reading from an XML document not remain a string unless otherwise specified.<|eor|><|sor|>Well type coercion is fine for dynamically typed languages as long as it's done in a sane manner. You obviously can't divide a string, so you first need to convert it into something that is divisible, `float` would be the right choice in this case. Mind you, [it has been accepted as a bug and is fixed in the latest version](https://www.reddit.com/r/lolphp/comments/8cndje/wat/dxhzsvb/).<|eor|><|sor|>Well sure but... if you're going to coerce a string in an equation where the other operand is a float then... why an int? I'm glad it's been fixed I'm just horrified it was ever an issue.<|eor|><|eols|><|endoftext|>
7
lolphp
cythrawll
dxhszx0
<|sols|><|sot|>wat<|eot|><|sol|>https://3v4l.org/l49VX<|eol|><|sor|>Haha, wat indeed. [I figured it out](https://3v4l.org/X3kb4). Somewhere the element is type coerced into an integer.<|eor|><|sor|>The real WTF is choosing to use simplexml over the better xml parsing dom choice, DOMDocument. come fight me. https://3v4l.org/nqCXQ<|eor|><|eols|><|endoftext|>
6
lolphp
DaRKoN_
11xn3a
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|eols|><|endoftext|>
69
lolphp
realnowhereman
c6qhhz1
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|soopr|>Can anyone explain how this happens?<|eoopr|><|sor|>php allows you to index into strings as if they were arrays, just to be even more broken: $str = 'bar'; $str[0] = 'x'; Same thing is happening here, since 'bar' == 0 when coerced to int. And apparently when you assign a longer string to a 1-long spot, it only stores the first char.<|eor|><|sor|>There is nothing wrong with array indexing strings; sometimes the elegant solution is to just treat them as a character array. The problem is that it doesn't return a new string, instead they are **mutable!** Fortunately they are also copy by value.<|eor|><|sor|>I don't think that's the problem either, if I write `$a[0] = 'w'` I expect `$a` to be mutable; the real WTF is that I can index the string with a non-numeric index. $a = 'foobar'; $a['lolphp'] = "I don't know what I'm doing"; should definitely throw an error instead of coercing 'lolphp' to 0, which makes no sense whatsoever. <|eor|><|eols|><|endoftext|>
23
lolphp
Tjoppen
c6qqdcp
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|sor|>[deleted]<|eor|><|sor|>>Wello The official /r/lolphp greeting<|eor|><|eols|><|endoftext|>
16
lolphp
DaRKoN_
c6qg8hh
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|soopr|>Can anyone explain how this happens?<|eoopr|><|eols|><|endoftext|>
9
lolphp
huf
c6qgc6n
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|soopr|>Can anyone explain how this happens?<|eoopr|><|sor|>php allows you to index into strings as if they were arrays, just to be even more broken: $str = 'bar'; $str[0] = 'x'; Same thing is happening here, since 'bar' == 0 when coerced to int. And apparently when you assign a longer string to a 1-long spot, it only stores the first char.<|eor|><|eols|><|endoftext|>
9
lolphp
realnowhereman
c6qoask
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|soopr|>Can anyone explain how this happens?<|eoopr|><|sor|>php allows you to index into strings as if they were arrays, just to be even more broken: $str = 'bar'; $str[0] = 'x'; Same thing is happening here, since 'bar' == 0 when coerced to int. And apparently when you assign a longer string to a 1-long spot, it only stores the first char.<|eor|><|sor|>There is nothing wrong with array indexing strings; sometimes the elegant solution is to just treat them as a character array. The problem is that it doesn't return a new string, instead they are **mutable!** Fortunately they are also copy by value.<|eor|><|sor|>I don't think that's the problem either, if I write `$a[0] = 'w'` I expect `$a` to be mutable; the real WTF is that I can index the string with a non-numeric index. $a = 'foobar'; $a['lolphp'] = "I don't know what I'm doing"; should definitely throw an error instead of coercing 'lolphp' to 0, which makes no sense whatsoever. <|eor|><|sor|>> PHP > throw an error Oh really?<|eor|><|sor|>Sorry. That was my bad.<|eor|><|eols|><|endoftext|>
8
lolphp
Browsing_From_Work
c8jufgo
<|sols|><|sot|>Guess the value of $foo<|eot|><|sol|>http://www.phpfiddle.org/lite/code/jxs-h05<|eol|><|sor|>Huh, it looks like this issue has been fixed. This is what I received (which is expected): Array ( [foo] => hello [bar] => Array ( [foo] => world ) ) <|eor|><|eols|><|endoftext|>
6
lolphp
dendeigh
8ecd0c
<|sols|><|sot|>`null["foo"] === null`, no notice, no warning :-/<|eot|><|sol|>https://3v4l.org/4A3QS<|eol|><|eols|><|endoftext|>
65
lolphp
cleeder
dxunoin
<|sols|><|sot|>`null["foo"] === null`, no notice, no warning :-/<|eot|><|sol|>https://3v4l.org/4A3QS<|eol|><|sor|>This is quite logical if you remember that string casts to 0 if they start with a letter. It gives you a warning but still evaluates 'foo' to 0 and gives you first letter. Second is also quite logical (if you take care of warnings of course)<|eor|><|sor|>The second and third usages aren't the ones being debated. They make (php-)sense. The issue is: $foo = null; $foo['foo'] === null As a null type, $foo has no keys, and should have no array access either. Array access on a null doesn't make sense. If however you posited that it made sense in php land because an array type could also be null (e.g. `?array $foo`) and therefore the null type should have array access, then the next-logical thing to do would to throw a warning about the undefined index, which at least would be consistent with array access elsewhere. This, however, does not happen. No warning. No error. It proceeds as if the variable was an initialized array, that array had the indicated key, and that key was initialized to null. That's 3 problems in one line of code.<|eor|><|eols|><|endoftext|>
13
lolphp
the_alias_of_andrea
dxuu6l1
<|sols|><|sot|>`null["foo"] === null`, no notice, no warning :-/<|eot|><|sol|>https://3v4l.org/4A3QS<|eol|><|sor|>IIRC it's a side-effect of how `$foo["bar"]["baz"] = [];` (where neither the variable nor the indices exist, they'll be created) is implemented. It's not great, yeah.<|eor|><|eols|><|endoftext|>
6
lolphp
cleeder
dxuo276
<|sols|><|sot|>`null["foo"] === null`, no notice, no warning :-/<|eot|><|sol|>https://3v4l.org/4A3QS<|eol|><|sor|>This is quite logical if you remember that string casts to 0 if they start with a letter. It gives you a warning but still evaluates 'foo' to 0 and gives you first letter. Second is also quite logical (if you take care of warnings of course)<|eor|><|sor|>The second and third usages aren't the ones being debated. They make (php-)sense. The issue is: $foo = null; $foo['foo'] === null As a null type, $foo has no keys, and should have no array access either. Array access on a null doesn't make sense. If however you posited that it made sense in php land because an array type could also be null (e.g. `?array $foo`) and therefore the null type should have array access, then the next-logical thing to do would to throw a warning about the undefined index, which at least would be consistent with array access elsewhere. This, however, does not happen. No warning. No error. It proceeds as if the variable was an initialized array, that array had the indicated key, and that key was initialized to null. That's 3 problems in one line of code.<|eor|><|sor|>Hey, cleeder, just a quick heads-up: **therefor** is actually spelled **therefore**. You can remember it by **ends with -fore**. Have a nice day! ^^^^The ^^^^parent ^^^^commenter ^^^^can ^^^^reply ^^^^with ^^^^'delete' ^^^^to ^^^^delete ^^^^this ^^^^comment.<|eor|><|sor|>It's not a misspelling. It's a grammatical incorrectness. `Therefor` is a word. Pedantic bot should at least be correct.<|eor|><|eols|><|endoftext|>
6
lolphp
shaql
dxzojvr
<|sols|><|sot|>`null["foo"] === null`, no notice, no warning :-/<|eot|><|sol|>https://3v4l.org/4A3QS<|eol|><|sor|>This is quite logical if you remember that string casts to 0 if they start with a letter. It gives you a warning but still evaluates 'foo' to 0 and gives you first letter. Second is also quite logical (if you take care of warnings of course)<|eor|><|sor|>The second and third usages aren't the ones being debated. They make (php-)sense. The issue is: $foo = null; $foo['foo'] === null As a null type, $foo has no keys, and should have no array access either. Array access on a null doesn't make sense. If however you posited that it made sense in php land because an array type could also be null (e.g. `?array $foo`) and therefore the null type should have array access, then the next-logical thing to do would to throw a warning about the undefined index, which at least would be consistent with array access elsewhere. This, however, does not happen. No warning. No error. It proceeds as if the variable was an initialized array, that array had the indicated key, and that key was initialized to null. That's 3 problems in one line of code.<|eor|><|sor|>Hey, cleeder, just a quick heads-up: **therefor** is actually spelled **therefore**. You can remember it by **ends with -fore**. Have a nice day! ^^^^The ^^^^parent ^^^^commenter ^^^^can ^^^^reply ^^^^with ^^^^'delete' ^^^^to ^^^^delete ^^^^this ^^^^comment.<|eor|><|sor|>It's not a misspelling. It's a grammatical incorrectness. `Therefor` is a word. Pedantic bot should at least be correct.<|eor|><|sor|>Don't even think about it.<|eor|><|sor|>Bad bot.<|eor|><|eols|><|endoftext|>
6
lolphp
GoodBot_BadBot
dxzojx4
<|sols|><|sot|>`null["foo"] === null`, no notice, no warning :-/<|eot|><|sol|>https://3v4l.org/4A3QS<|eol|><|sor|>This is quite logical if you remember that string casts to 0 if they start with a letter. It gives you a warning but still evaluates 'foo' to 0 and gives you first letter. Second is also quite logical (if you take care of warnings of course)<|eor|><|sor|>The second and third usages aren't the ones being debated. They make (php-)sense. The issue is: $foo = null; $foo['foo'] === null As a null type, $foo has no keys, and should have no array access either. Array access on a null doesn't make sense. If however you posited that it made sense in php land because an array type could also be null (e.g. `?array $foo`) and therefore the null type should have array access, then the next-logical thing to do would to throw a warning about the undefined index, which at least would be consistent with array access elsewhere. This, however, does not happen. No warning. No error. It proceeds as if the variable was an initialized array, that array had the indicated key, and that key was initialized to null. That's 3 problems in one line of code.<|eor|><|sor|>Hey, cleeder, just a quick heads-up: **therefor** is actually spelled **therefore**. You can remember it by **ends with -fore**. Have a nice day! ^^^^The ^^^^parent ^^^^commenter ^^^^can ^^^^reply ^^^^with ^^^^'delete' ^^^^to ^^^^delete ^^^^this ^^^^comment.<|eor|><|sor|>It's not a misspelling. It's a grammatical incorrectness. `Therefor` is a word. Pedantic bot should at least be correct.<|eor|><|sor|>Don't even think about it.<|eor|><|sor|>Bad bot.<|eor|><|sor|>Thank you, shaql, for voting on CommonMisspellingBot. This bot wants to find the best and worst bots on Reddit. [You can view results here](https://goodbot-badbot.herokuapp.com/). *** ^^Even ^^if ^^I ^^don't ^^reply ^^to ^^your ^^comment, ^^I'm ^^still ^^listening ^^for ^^votes. ^^Check ^^the ^^webpage ^^to ^^see ^^if ^^your ^^vote ^^registered!<|eor|><|eols|><|endoftext|>
6
lolphp
TheBuzzSaw
3u0ija
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|eols|><|endoftext|>
65
lolphp
PlasmaSheep
cxavg70
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|eols|><|endoftext|>
102
lolphp
merreborn
cxax4k5
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>Note: "wordpress core" is still PHP for the forseeable future. This *might* replace the wp-admin UI, eventually. So don't get your hopes up. Poorly written, vulnerable PHP plugins for wordpress will still be here for years to come.<|eor|><|eols|><|endoftext|>
36
lolphp
cbraga
cxb0ulu
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>it gets better! > 100% API-powered. <|eor|><|eols|><|endoftext|>
36
lolphp
mellett68
cxb7ynn
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>Note: "wordpress core" is still PHP for the forseeable future. This *might* replace the wp-admin UI, eventually. So don't get your hopes up. Poorly written, vulnerable PHP plugins for wordpress will still be here for years to come.<|eor|><|sor|>I'm sure there's plenty of scope for poorly written, vulnerable javascript plugins.<|eor|><|eols|><|endoftext|>
35
lolphp
cliath
cxb7xcc
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>it gets better! > 100% API-powered. <|eor|><|sor|>I love the comparison table for the PHP version and Calypso: Aspect | Old | New ------|---|--- Powered By | PHP and MySQL | JavaScript and REST API JavaScript is my favorite database, followed closely by REST api database! <|eor|><|eols|><|endoftext|>
28
lolphp
catcradle5
cxbcj0t
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>[deleted]<|eor|><|sor|>Honestly, better a meme than PHP. Node and *.js are fads, but it's been around for quite a while and is much better designed than PHP. I'm not a big fan of it, but given the choice between Node and PHP, I would make a new application in Node any day.<|eor|><|eols|><|endoftext|>
23
lolphp
leyou
cxcgnrz
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>Really? I think PHP is more fed up with Wordpress than the opposite.<|eor|><|eols|><|endoftext|>
9
lolphp
merreborn
cxbgzni
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>Note: "wordpress core" is still PHP for the forseeable future. This *might* replace the wp-admin UI, eventually. So don't get your hopes up. Poorly written, vulnerable PHP plugins for wordpress will still be here for years to come.<|eor|><|sor|>it ___is___ a wp-admin replacement ? <|eor|><|sor|>Only for immediate use on wordpress.com. there is no time line for adding it to the downloadable wordpress package. Also it will throw a wrench in one of their main selling points: ease of install. Cheap hosting plans don't always support node.<|eor|><|eols|><|endoftext|>
9
lolphp
cliath
cxbuskj
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>it gets better! > 100% API-powered. <|eor|><|sor|>I love the comparison table for the PHP version and Calypso: Aspect | Old | New ------|---|--- Powered By | PHP and MySQL | JavaScript and REST API JavaScript is my favorite database, followed closely by REST api database! <|eor|><|sor|>You know, yeah, it's a bad comparison, and I understand why we're laughing. But actually I rather like what they're implying - that this is a "modern" (well, OK, this has been considered best practices for a very long time...) webservices-based architecture rather than the monolithic design that is Wordpress. It suggests they're going in the right direction, though, to be honest, when it comes to beating Wordpress, that's a very low bar.<|eor|><|sor|>I would feel the same way, except with they way they describe it I'm left thinking they are dumb or they think their customers/users are dumb. It makes me immediately not trust the new product :(<|eor|><|eols|><|endoftext|>
9
lolphp
losingthefight
cxb41bd
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>[deleted]<|eor|><|sor|>It's been around for 6 years! They're started releasing [long term support](https://nodejs.org/en/blog/release/v4.2.0/) versions with 30 months of support, the package library (npm) has now [more than double](http://www.modulecounts.com/) the number of modules of any other language (including Ruby gems), it's in production use for a number of high profile companies including [PayPal](https://www.joyent.com/developers/videos/node-js-on-the-road-sf-node-js-at-paypal), [Walmart](https://www.joyent.com/developers/videos/node-js-at-walmart-introduction) and [eBay](https://www.joyent.com/developers/videos/node-js-at-walmart-introduction), the [new version of JavaScript](https://github.com/lukehoban/es6features#ecmascript-6-features), ES6, smooths out many of the annoying features of previous versions by removing the need for nested callbacks, adding classes, multiline strings, lambda functions, and numerous other features supported by node. I could go on but I think Node is a little beyond a fad at this point<|eor|><|sor|>I just want first party multithreading. Callbacks and async is nice but there's a time and a place where real threading and multiprocessing are incredibly useful. <|eor|><|sor|>And for that, NodeJS isn't your best solution. Sure, you could cluster and have separate Node threads, but if you want true multi-threading, NodeJS won't be your best tool. A good programmer knows which tools are best suited for what. Not knowing your use case, I can only speculate. If I were to do a web app that needed some multi threading, I would either a) use Elixir, b) use Go, c) use NodeJS with an event queue and have several processes listening. The fact is, NodeJS is great for some things (quick web apps or APIs) and not great for other things (intensive CPU apps, apps needing many parallel tasks in a multithreaded environment). I once wrote PHP day in and day out for 5 years as a senior engineer; I haven't touched PHP in the previous 4 and haven't looked back. Of course, that is just my experience; as always your mileage may vary.<|eor|><|eols|><|endoftext|>
7
lolphp
TMiguelT
cxb1tas
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>[deleted]<|eor|><|sor|>It's been around for 6 years! They're started releasing [long term support](https://nodejs.org/en/blog/release/v4.2.0/) versions with 30 months of support, the package library (npm) has now [more than double](http://www.modulecounts.com/) the number of modules of any other language (including Ruby gems), it's in production use for a number of high profile companies including [PayPal](https://www.joyent.com/developers/videos/node-js-on-the-road-sf-node-js-at-paypal), [Walmart](https://www.joyent.com/developers/videos/node-js-at-walmart-introduction) and [eBay](https://www.joyent.com/developers/videos/node-js-at-walmart-introduction), the [new version of JavaScript](https://github.com/lukehoban/es6features#ecmascript-6-features), ES6, smooths out many of the annoying features of previous versions by removing the need for nested callbacks, adding classes, multiline strings, lambda functions, and numerous other features supported by node. I could go on but I think Node is a little beyond a fad at this point<|eor|><|eols|><|endoftext|>
6
lolphp
TMiguelT
cxbdqlx
<|sols|><|sot|>Even Wordpress is fed up with PHP<|eot|><|sol|>http://ma.tt/2015/11/dance-to-calypso/<|eol|><|sor|>>Today were announcing something brand new, a new approach to WordPress, and open sourcing the code behind it. Wow, it's great to have a project like this leave php behind... >Written purely in JavaScript, leveraging libraries like Node and React. Holy fuck I've webscaled and I can't get up<|eor|><|sor|>[deleted]<|eor|><|sor|>It's been around for 6 years! They're started releasing [long term support](https://nodejs.org/en/blog/release/v4.2.0/) versions with 30 months of support, the package library (npm) has now [more than double](http://www.modulecounts.com/) the number of modules of any other language (including Ruby gems), it's in production use for a number of high profile companies including [PayPal](https://www.joyent.com/developers/videos/node-js-on-the-road-sf-node-js-at-paypal), [Walmart](https://www.joyent.com/developers/videos/node-js-at-walmart-introduction) and [eBay](https://www.joyent.com/developers/videos/node-js-at-walmart-introduction), the [new version of JavaScript](https://github.com/lukehoban/es6features#ecmascript-6-features), ES6, smooths out many of the annoying features of previous versions by removing the need for nested callbacks, adding classes, multiline strings, lambda functions, and numerous other features supported by node. I could go on but I think Node is a little beyond a fad at this point<|eor|><|sor|><|eor|><|sor|>It's not so much an argument for node's success as an argument that node isn't a fad. I'm sure that 90% of the libraries are absolute trash, but it does indicate that there's a pretty big community that's tried to help everyone else out by sharing their modules <|eor|><|eols|><|endoftext|>
6