subreddit
stringclasses
7 values
author
stringlengths
3
20
id
stringlengths
5
7
content
stringlengths
67
30.4k
score
int64
0
140k
lolphp
OmnipotentEntity
dnz3u7v
<|sols|><|sot|>Warning: SSL: The operation completed successfully.<|eot|><|sol|>https://stackoverflow.com/questions/46337963/php-soap-clients-http-headers-error<|eol|><|sor|>Isn't that more lolwin32 then lolphp? The native code called a SetLastError function in between detecting that something failed and calling GetLastError to get the HRESULT. The second function call succeeded and changed the global error state to E_SUCCESS. Later on, the error handler tried to look up the error message for what it was the error code (but was actually E_SUCCESS) which happens to be "The operation completed successfully." So, no, this isn't a lolphp. You can blame this one squarely on Microsoft.<|eor|><|sor|>>Isn't that more lolwin32 then lolphp? The native code called a SetLastError function in between detecting that something failed and calling GetLastError to get the HRESULT. The second function call succeeded and changed the global error state to E_SUCCESS. Later on, the error handler tried to look up the error message for what it was the error code (but was actually E_SUCCESS) which happens to be "The operation completed successfully." How do you figure native code is responsible? Couldn't php be calling two win32 functions itself? <|eor|><|eols|><|endoftext|>
8
lolphp
AnarchistPrick
4tm2sw
<|sols|><|sot|>PHP creates array keys out of nowhere<|eot|><|sol|>https://3v4l.org/OAqGa<|eol|><|eols|><|endoftext|>
28
lolphp
AnarchistPrick
d5igpee
<|sols|><|sot|>PHP creates array keys out of nowhere<|eot|><|sol|>https://3v4l.org/OAqGa<|eol|><|sor|>Just like any modern JavaScript has "use strict" as the first line, most modern PHP frameworks convert errors to exceptions. So the Warning on line 8 will become an exception, and there's no chance you will be surprised by this behavior. I've seem old code that ignores E_NOTICE but never E_WARNING. For this bug to exist you are ignoring warnings/exceptions and using a reference to an undefined array key. I think you've gone too far :P <|eor|><|soopr|>I'm working with a legacy inherited code base which relies on standard php error handling. Most modern frameworks don't throw exceptions for php warnings in production. But yes... I see where you're getting at. <|eoopr|><|eols|><|endoftext|>
14
lolphp
carlos_vini
d5icqvu
<|sols|><|sot|>PHP creates array keys out of nowhere<|eot|><|sol|>https://3v4l.org/OAqGa<|eol|><|sor|>Just like any modern JavaScript has "use strict" as the first line, most modern PHP frameworks convert errors to exceptions. So the Warning on line 8 will become an exception, and there's no chance you will be surprised by this behavior. I've seem old code that ignores E_NOTICE but never E_WARNING. For this bug to exist you are ignoring warnings/exceptions and using a reference to an undefined array key. I think you've gone too far :P <|eor|><|eols|><|endoftext|>
13
lolphp
Miserable_Fuck
d5jjvzh
<|sols|><|sot|>PHP creates array keys out of nowhere<|eot|><|sol|>https://3v4l.org/OAqGa<|eol|><|sor|>Just like any modern JavaScript has "use strict" as the first line, most modern PHP frameworks convert errors to exceptions. So the Warning on line 8 will become an exception, and there's no chance you will be surprised by this behavior. I've seem old code that ignores E_NOTICE but never E_WARNING. For this bug to exist you are ignoring warnings/exceptions and using a reference to an undefined array key. I think you've gone too far :P <|eor|><|sor|>That fact that you recommend a whole framework to avoid this problem (because vanilla php is retarded) is a lol in itself.<|eor|><|eols|><|endoftext|>
11
lolphp
Bl00dsoul
d5jtc8b
<|sols|><|sot|>PHP creates array keys out of nowhere<|eot|><|sol|>https://3v4l.org/OAqGa<|eol|><|sor|>Basically; don't ever use references in php. [They don't work the way you think they do](https://secure.php.net/manual/en/language.references.whatdo.php) <|eor|><|eols|><|endoftext|>
7
lolphp
the_alias_of_andrea
d5mp4l6
<|sols|><|sot|>PHP creates array keys out of nowhere<|eot|><|sol|>https://3v4l.org/OAqGa<|eol|><|sor|>This seems unintuitive when written as in the example, but it can be written more simply: <?php $a = []; $b = &$a['some_key']; var_dump($a); If you run that, you'll find there's now a `'some_key'` entry in `$a`. Why? Well, you created a reference to `$a['some_key']`. In order to have a reference to a variable (or in this case, an array element), a variable must first exist. So PHP creates one, and fills in null. The other possible behaviour could have been to throw an error. But then you'd have to declare variables before you can pass them to a function taking parameters by reference (as out parameters), which is rather inconvenient, and doesn't fit with being able to assign to variables without first declaring them. That is, if you don't have to declare `$a` in order to do `$a = 1;`, you shouldn't have to declare `$a` in order to do `some_function($a);` where `some_function` takes a parameter by reference.<|eor|><|eols|><|endoftext|>
6
lolphp
esquilax
46m90k
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|eols|><|endoftext|>
28
lolphp
kd0ocr
d067r12
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>The cruiseliner attempts to dock at a fishing wharf, and is automatically typecasted to a dinghy. Everyone's computers fall into the ocean. None of it is backed up.<|eor|><|eols|><|endoftext|>
36
lolphp
mort96
d06s37c
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>`> PHP[cruise]` `PHP[cruise]`. That's a tough one, but as a helpful PHP interpreter, I'm going to try to interpret it nonetheless. First off, PHP is just a random piece of text, no context really. It's not a function, and since it doesn't have a dollar sign, it can't be a variable, and it's not any other piece of syntax. I'm therefore going to assume Master meant "PHP", and just pretend it's that string. So now, we have `"PHP"[cruise]`. We're going places! But we're still not done. We take the string "PHP", and we're dereferencing - dereferencing what exactly? `cruice`. There's no function named cruice, and it doesn't match any other piece of syntax I know, so I'm just gonna assume that too is a string. Master is getting sloppy with his quotes. Anyways, I will proceed, confident that Master meant `"PHP"["cruice"]`. But wait. "cruice" isn't a number. I need it to be a number. I know how to do that! "cruice" doesn't look a lot like a number, so Master probably meant 0. Now we have "PHP"[0]. Aha! I know how to solve that! I must tell Master his expression evaluates to "P"!<|eor|><|eols|><|endoftext|>
28
lolphp
InconsiderateBastard
d06fxjf
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>The cruise ship uses sails and carries attendees across the ocean to sell as human slaves in a noble attempt to maintain backwards compatibility. EDIT: The sign up form allows for random roommates but asks attendees for "Gender" and is confused when an attendee sexually identifies as EAST_FRISIA.<|eor|><|eols|><|endoftext|>
26
lolphp
ToddlahAkbar
d069pfl
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>Someone named: Robert); DROP TABLE Passengers; -- Attends and now there is no cruise. <|eor|><|eols|><|endoftext|>
22
lolphp
ThisIsADogHello
d06mhg5
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>They have record attendance with NaN attendees. Random events taking place on the cruise fail to happen, citing "Error establishing a database connection" The con goes bankrupt when someone figures out that they could put an array[] for the ticket's serial number and it'd always be accepted as valid. <|eor|><|eols|><|endoftext|>
20
lolphp
loath
d06hly1
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>Someone named: Robert); DROP TABLE Passengers; -- Attends and now there is no cruise. <|eor|><|sor|>Good try, except: ORA-01756: quoted string not properly terminated<|eor|><|eols|><|endoftext|>
17
lolphp
cbraga
d06eipz
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>The cruiseliner attempts to dock at a fishing wharf, and is automatically typecasted to a dinghy. Everyone's computers fall into the ocean. None of it is backed up.<|eor|><|sor|>> ~~Everyone's computers fall into the ocean. None of it is backed up.~~ Everyone falls into the ocean. None of the PHP devs knew how to swim and they were too heavy that rescuers were unable to pull them up into their boats. 1700 people died. PHP is over. The next morning, all websites are faster, hackers are lost without targets and the Sun is shining just a little bit brighter.<|eor|><|eols|><|endoftext|>
9
lolphp
FredL2
d08jvsc
<|sols|><|sot|>Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?<|eot|><|sol|>https://cruise.phparch.com/<|eol|><|sor|>The cruiseliner attempts to dock at a fishing wharf, and is automatically typecasted to a dinghy. Everyone's computers fall into the ocean. None of it is backed up.<|eor|><|sor|>> ~~Everyone's computers fall into the ocean. None of it is backed up.~~ Everyone falls into the ocean. None of the PHP devs knew how to swim and they were too heavy that rescuers were unable to pull them up into their boats. 1700 people died. PHP is over. The next morning, all websites are faster, hackers are lost without targets and the Sun is shining just a little bit brighter.<|eor|><|sor|>> the Sun is shining Subtly beautiful<|eor|><|eols|><|endoftext|>
7
lolphp
the_alias_of_andrea
3zzo3z
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|eols|><|endoftext|>
29
lolphp
SirClueless
cyqfcbz
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|sor|>Wow, what a mess. PHP. Doesn't have types. Except when it has types.<|eor|><|sor|>Php isn't BCPL, of course it has types.<|eor|><|sor|>When your mathematical operators accept strings as arguments, your type system might be a redneck.<|eor|><|eols|><|endoftext|>
23
lolphp
the_alias_of_andrea
cyqaonk
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|soopr|>Turns out that where PHP expects an integer, it sometimes, but not always, does not respect floating-point exponents. The worst bit is I know exactly why this happens. :(<|eoopr|><|eols|><|endoftext|>
18
lolphp
the_alias_of_andrea
cyqhsw0
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|soopr|>Turns out that where PHP expects an integer, it sometimes, but not always, does not respect floating-point exponents. The worst bit is I know exactly why this happens. :(<|eoopr|><|sor|>Why?<|eor|><|soopr|>In some cases PHP parses numbers with `zend_is_numeric_string_ex`, which supports the floating point exponent notation. In other cases it simply uses `strtol` which is for integers and does not.<|eoopr|><|eols|><|endoftext|>
15
lolphp
SirClueless
cyqdopb
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|sor|>Wow, what a mess. PHP. Doesn't have types. Except when it has types.<|eor|><|eols|><|endoftext|>
12
lolphp
SirClueless
cyqihs5
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|sor|>Wow, what a mess. PHP. Doesn't have types. Except when it has types.<|eor|><|sor|>Php isn't BCPL, of course it has types.<|eor|><|sor|>When your mathematical operators accept strings as arguments, your type system might be a redneck.<|eor|><|sor|>PHP is dynamically typed. It has types, it just converts between them as necessary (well, "necessary").<|eor|><|sor|>PHP, more than otherwise-similar dynamically-typed languages like Python and Ruby, makes an effort to ignore the types of variables when it can. For example, this is why PHP's string concatenation is an entirely distinct operator "." instead of overloading + to mean concatenation when applied to strings the way many languages do. It is something of a design tenet: if you are explicit with your operations, then it should be no problem that a great many primitive types are implicitly convertible to others. Other languages that follow this design pattern include Perl and Javascript, but PHP goes even further. This is what I mean when I say PHP "Doesn't have types," and I stand by it.<|eor|><|eols|><|endoftext|>
10
lolphp
stubborn_d0nkey
cyqdrfm
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|soopr|>Turns out that where PHP expects an integer, it sometimes, but not always, does not respect floating-point exponents. The worst bit is I know exactly why this happens. :(<|eoopr|><|sor|>Why?<|eor|><|eols|><|endoftext|>
8
lolphp
Drainedsoul
cyqnnoc
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|sor|>Wow, what a mess. PHP. Doesn't have types. Except when it has types.<|eor|><|sor|>Php isn't BCPL, of course it has types.<|eor|><|sor|>When your mathematical operators accept strings as arguments, your type system might be a redneck.<|eor|><|sor|>PHP is dynamically typed. It has types, it just converts between them as necessary (well, "necessary").<|eor|><|sor|>That's not what dynamic typing means. You may be thinking of weak typing. <|eor|><|eols|><|endoftext|>
7
lolphp
the_alias_of_andrea
cyqhrta
<|sols|><|sot|>How many decimal places in 3.34e3?<|eot|><|sol|>https://3v4l.org/pXc0R<|eol|><|sor|>I have a different question: where the heck did intdiv go in 5.3 to 5.6?<|eor|><|soopr|>It was only added in 7.<|eoopr|><|eols|><|endoftext|>
5
lolphp
bl_nk
1gkvtb
<|soss|><|sot|>Accessing FALSE as array<|eot|><|sost|> <?php error_reporting( -1 ); // no errors, nothing: $array = false; $array['nonexisting_key']; // [Notice] Undefined index: nonexisting_key $array = array(); $array['nonexisting_key']; <|eost|><|eoss|><|endoftext|>
27
lolphp
InconsiderateBastard
cal7ewy
<|soss|><|sot|>Accessing FALSE as array<|eot|><|sost|> <?php error_reporting( -1 ); // no errors, nothing: $array = false; $array['nonexisting_key']; // [Notice] Undefined index: nonexisting_key $array = array(); $array['nonexisting_key']; <|eost|><|sor|>At least it's a documented behavior :-/ Edit: for the curious, accessing an array, a string, or an appropriate object with [] can return values and raise notices/errors if there are problems with the index you use. Accessing anything else silently returns NULL.<|eor|><|eoss|><|endoftext|>
11
lolphp
bl_nk
cal8auh
<|soss|><|sot|>Accessing FALSE as array<|eot|><|sost|> <?php error_reporting( -1 ); // no errors, nothing: $array = false; $array['nonexisting_key']; // [Notice] Undefined index: nonexisting_key $array = array(); $array['nonexisting_key']; <|eost|><|sor|>At least it's a documented behavior :-/ Edit: for the curious, accessing an array, a string, or an appropriate object with [] can return values and raise notices/errors if there are problems with the index you use. Accessing anything else silently returns NULL.<|eor|><|soopr|>This is so infuriating. I was burned heavily by this once when I changed the signature of a method to return string instead of array and left one its usage unrefractored. I found out about the bug months later from an attacker :/<|eoopr|><|eoss|><|endoftext|>
9
lolphp
BufferUnderpants
cal8qer
<|soss|><|sot|>Accessing FALSE as array<|eot|><|sost|> <?php error_reporting( -1 ); // no errors, nothing: $array = false; $array['nonexisting_key']; // [Notice] Undefined index: nonexisting_key $array = array(); $array['nonexisting_key']; <|eost|><|sor|>At least it's a documented behavior :-/ Edit: for the curious, accessing an array, a string, or an appropriate object with [] can return values and raise notices/errors if there are problems with the index you use. Accessing anything else silently returns NULL.<|eor|><|sor|>Only bad programmers would access an index of anything but an array. Why bother reporting this? Edit: must I really declare my post to be /s? This is a *weakly typed* subreddit, dontcha know?<|eor|><|eoss|><|endoftext|>
9
lolphp
skeeto
calgvoi
<|soss|><|sot|>Accessing FALSE as array<|eot|><|sost|> <?php error_reporting( -1 ); // no errors, nothing: $array = false; $array['nonexisting_key']; // [Notice] Undefined index: nonexisting_key $array = array(); $array['nonexisting_key']; <|eost|><|sor|>At least it's a documented behavior :-/ Edit: for the curious, accessing an array, a string, or an appropriate object with [] can return values and raise notices/errors if there are problems with the index you use. Accessing anything else silently returns NULL.<|eor|><|soopr|>This is so infuriating. I was burned heavily by this once when I changed the signature of a method to return string instead of array and left one its usage unrefractored. I found out about the bug months later from an attacker :/<|eoopr|><|sor|>There isn't much lolphp in that story. Accessing elements of a string using an array format isn't exactly unheard of. The bizarre thing is that you can use the array format for non-indexed values and not get an error. A mistake like the one you made would bite you in the ass in many languages and your fury should only be directed at yourself.<|eor|><|sor|>> A mistake like the one you made would bite you in the ass in many languages Not in a strongly-typed language. After several years with PHP, I can't wait to get back to a strongly typed language with a compiler. So many PHP errors that manifest at runtime would be trivially caught as compiler errors in a language like Java.<|eor|><|sor|>> ~~strongly~~statically-typed It's static type checking, not the lack of implicit type coercion (weakly-typed), that would find this problem at compile time.<|eor|><|eoss|><|endoftext|>
8
lolphp
audaxxx
1coccc
<|sols|><|sot|>You can't upload files larger than 2gb via http with PHP<|eot|><|sol|>https://bugs.php.net/bug.php?id=44522<|eol|><|eols|><|endoftext|>
31
lolphp
gearvOsh
c9ij9df
<|sols|><|sot|>You can't upload files larger than 2gb via http with PHP<|eot|><|sol|>https://bugs.php.net/bug.php?id=44522<|eol|><|sor|>I feel if you need to upload more than 2GB, doing a pure HTTP upload in a single go is the wrong approach. Hey, but at least they are attempting to patch it instead of saying "nope not a bug".<|eor|><|eols|><|endoftext|>
13
lolphp
audaxxx
c9ij8ym
<|sols|><|sot|>You can't upload files larger than 2gb via http with PHP<|eot|><|sol|>https://bugs.php.net/bug.php?id=44522<|eol|><|sor|>HTTP uploads of 2GB files all in one go? Nothing could possibly go wrong.<|eor|><|soopr|>WebDav uses http and owncloud provides WebDAV. There definitely is a use case for this. I sync my files with the kde's dolphin and was quite surprised that not all files were transferred.<|eoopr|><|eols|><|endoftext|>
8
lolphp
phoshi
c9iotue
<|sols|><|sot|>You can't upload files larger than 2gb via http with PHP<|eot|><|sol|>https://bugs.php.net/bug.php?id=44522<|eol|><|sor|>I feel if you need to upload more than 2GB, doing a pure HTTP upload in a single go is the wrong approach. Hey, but at least they are attempting to patch it instead of saying "nope not a bug".<|eor|><|sor|>I can see it being sensible if the server is over a fast LAN, because the overhead of creating a better uploader isn't zero. Over the internet it'd be insane, but just because something is insane doesn't mean it shouldn't work!<|eor|><|eols|><|endoftext|>
8
lolphp
audaxxx
c9ik89g
<|sols|><|sot|>You can't upload files larger than 2gb via http with PHP<|eot|><|sol|>https://bugs.php.net/bug.php?id=44522<|eol|><|sor|>HTTP uploads of 2GB files all in one go? Nothing could possibly go wrong.<|eor|><|soopr|>WebDav uses http and owncloud provides WebDAV. There definitely is a use case for this. I sync my files with the kde's dolphin and was quite surprised that not all files were transferred.<|eoopr|><|sor|>Oh I realise there's a use case, I just don't trust HTTP as a protocol for uploading files, since it hasn't been too reliable in the other direction, for me.<|eor|><|soopr|>I just used it because I had a 10gb connection, so the 2gb didn't take long. 10gb internet connections are fun.<|eoopr|><|eols|><|endoftext|>
8
lolphp
audaxxx
c9iot99
<|sols|><|sot|>You can't upload files larger than 2gb via http with PHP<|eot|><|sol|>https://bugs.php.net/bug.php?id=44522<|eol|><|sor|>HTTP uploads of 2GB files all in one go? Nothing could possibly go wrong.<|eor|><|soopr|>WebDav uses http and owncloud provides WebDAV. There definitely is a use case for this. I sync my files with the kde's dolphin and was quite surprised that not all files were transferred.<|eoopr|><|sor|>Oh I realise there's a use case, I just don't trust HTTP as a protocol for uploading files, since it hasn't been too reliable in the other direction, for me.<|eor|><|soopr|>I just used it because I had a 10gb connection, so the 2gb didn't take long. 10gb internet connections are fun.<|eoopr|><|sor|>Are at a university? Do you work at Google?<|eor|><|soopr|>We've put most of our servers into a data center 100m down the street and have a fiber connection to them. It is pretty sweet.<|eoopr|><|eols|><|endoftext|>
8
lolphp
midir
vv4b3
<|sols|><|sot|>"Remove this function and see if anyone notices"<|eot|><|sol|>https://bugs.php.net/bug.php?id=62450<|eol|><|eols|><|endoftext|>
31
lolphp
k3n
c57yxsw
<|sols|><|sot|>"Remove this function and see if anyone notices"<|eot|><|sol|>https://bugs.php.net/bug.php?id=62450<|eol|><|sor|>lol, that bug was submitted less than 24 hrs ago and hasn't even been assigned. Not to mention that the function in question is a part of the zlib extension.<|eor|><|eols|><|endoftext|>
8
lolphp
mithaldu
c5854ff
<|sols|><|sot|>"Remove this function and see if anyone notices"<|eot|><|sol|>https://bugs.php.net/bug.php?id=62450<|eol|><|sor|>I know it's wrong of me to say this but it's things like this that make me love PHP. I like it when something is just a little bit crazy. Makes life more fun.<|eor|><|sor|>"A little bit crazy" is great for experimentation, learning, and hacking. For anything mission-critical? Not so much. <|eor|><|sor|>Yet there's plenty of big companies that use it for mission-critical.<|eor|><|sor|>Are you trying to make an [appeal to popularity](http://en.wikipedia.org/wiki/Argumentum_ad_populum)?<|eor|><|sor|>I'm just saying that clearly PHP isn't only suitable for fun experimentation when it's the most widely used language in production.<|eor|><|sor|>That is an appeal to popularity. Yes, it can be used for many things. A hammer with claws on both sides can also be used for many things and depending on how it's build you can even use it to draw straight lines. However, even if 99.99% of the world were using it, doesn't mean that other things aren't MUCH better suited for almost anything you could do with that hammer.<|eor|><|sor|>So why aren't they used? If a company like, say, Facebook can serve almost a billion active users with PHP (albeit a mangled HipHop PHP), why is it not considered suitable? Why are the "much better" tools not compelling enough to use?<|eor|><|sor|>See, Facebook is the best example here. HipHop PHP is not actually PHP anymore. It is a PHP compiler that takes PHP source code and transforms it into C++. Zend's software isn't actually involved anymore. And why they use it: Simple. It was cheaper to do than to rewrite all their stuff. Businesses are about making money and that's how they make their decisions. PHP has another big advantage for businesses: PHP developers are a lot cheaper. Doesn't mean they're any good, but you can get 10 PHP devs for the cash it'd take to pay one Ruby dev.<|eor|><|eols|><|endoftext|>
8
lolphp
more_exercise
c58m1ym
<|sols|><|sot|>"Remove this function and see if anyone notices"<|eot|><|sol|>https://bugs.php.net/bug.php?id=62450<|eol|><|sor|>it will probably get forced to go through the E_DEPRECATION warning route before removal.<|eor|><|sor|>it ~~will probably~~ **had fucking better** get forced to go through the E_DEPRECATION warning route before removal. <|eor|><|eols|><|endoftext|>
7
lolphp
mithaldu
c5866t9
<|sols|><|sot|>"Remove this function and see if anyone notices"<|eot|><|sol|>https://bugs.php.net/bug.php?id=62450<|eol|><|sor|>Yet there's plenty of big companies that use it for mission-critical.<|eor|><|sor|>Are you trying to make an [appeal to popularity](http://en.wikipedia.org/wiki/Argumentum_ad_populum)?<|eor|><|sor|>I'm just saying that clearly PHP isn't only suitable for fun experimentation when it's the most widely used language in production.<|eor|><|sor|>That is an appeal to popularity. Yes, it can be used for many things. A hammer with claws on both sides can also be used for many things and depending on how it's build you can even use it to draw straight lines. However, even if 99.99% of the world were using it, doesn't mean that other things aren't MUCH better suited for almost anything you could do with that hammer.<|eor|><|sor|>So why aren't they used? If a company like, say, Facebook can serve almost a billion active users with PHP (albeit a mangled HipHop PHP), why is it not considered suitable? Why are the "much better" tools not compelling enough to use?<|eor|><|sor|>See, Facebook is the best example here. HipHop PHP is not actually PHP anymore. It is a PHP compiler that takes PHP source code and transforms it into C++. Zend's software isn't actually involved anymore. And why they use it: Simple. It was cheaper to do than to rewrite all their stuff. Businesses are about making money and that's how they make their decisions. PHP has another big advantage for businesses: PHP developers are a lot cheaper. Doesn't mean they're any good, but you can get 10 PHP devs for the cash it'd take to pay one Ruby dev.<|eor|><|sor|>Okay sure. You are stuck with what you started with to a degree. But why would new companies continue to keep using PHP? It just doesn't seem to make any sense that if PHP is so bad as everyone says it is, why it's still the go-to language. I don't know anything about other languages so that's why I'm inquisitive. What is it about - say - Ruby that makes it "better" than PHP? And why wouldn't those improvements be compelling enough for new companies to choose to start working with it instead of going with PHP?<|eor|><|sor|>Up-front expenditure with PHP is less than with other languages. You get more devs for less money and your product will be done faster. On the other hand you end up dumping a lot more time and maintenance into the product afterwards, but that'll be someone else's responsibility. As for other languages and why they're better, it's easier to say why PHP is worse than literally everything out there: http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/<|eor|><|eols|><|endoftext|>
6
lolphp
Nivla
c584dbn
<|sols|><|sot|>"Remove this function and see if anyone notices"<|eot|><|sol|>https://bugs.php.net/bug.php?id=62450<|eol|><|sor|>lol, that bug was submitted less than 24 hrs ago and hasn't even been assigned. Not to mention that the function in question is a part of the zlib extension.<|eor|><|sor|>More likely, OP submitted the bug and took a screenshot for karma whoring.<|eor|><|eols|><|endoftext|>
5
lolphp
vytah
veub9
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|eols|><|endoftext|>
30
lolphp
esquilax
c53wuro
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>I was laughing, then I was crying.. because I knew Rasmus wasn't kidding. Somebody really needs to point that guy at Uncle Bob's "The Clean Coder." I mean, wtf, the first rule is "don't break working code" ... you just don't... wtf.<|eor|><|sor|>I think the first rule should be don't write software that does financial calculations using undocumented behavior in PHP... <|eor|><|eols|><|endoftext|>
16
lolphp
aaronla
c53z0mc
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>I was laughing, then I was crying.. because I knew Rasmus wasn't kidding. Somebody really needs to point that guy at Uncle Bob's "The Clean Coder." I mean, wtf, the first rule is "don't break working code" ... you just don't... wtf.<|eor|><|sor|>I think the first rule should be don't write software that does financial calculations using undocumented behavior in PHP... <|eor|><|sor|>Couldn't you just shorten that to "don't write in PHP"? Or at least, don't expect it to be something it's not.<|eor|><|eols|><|endoftext|>
15
lolphp
kenlubin
c53wwlf
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>1. I appreciate that they are standardizing the inputs on php. 2. This person doesn't really need to migrate to php 5.3 if it is going to require months worth of work. 3. These people are not qualified to write tax software.<|eor|><|eols|><|endoftext|>
14
lolphp
ThisIsADogHello
c53vman
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>"I really don't like programming. I built this tool to program less so that I could just reuse code." -- Rasmus Lerdorf, 2003-11-19 "Part of your responsibility in your position is to keep track of your tools and the changes coming down the pipeline." -- Rasmus Lerdorf, 2010-01-08 Looks like he changed his stance on the value of reusing code.<|eor|><|eols|><|endoftext|>
9
lolphp
jaesharp
c53v38e
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>I was laughing, then I was crying.. because I knew Rasmus wasn't kidding. Somebody really needs to point that guy at Uncle Bob's "The Clean Coder." I mean, wtf, the first rule is "don't break working code" ... you just don't... wtf.<|eor|><|eols|><|endoftext|>
8
lolphp
skztr
c53z0wl
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>Number_format() is for formatting numbers... Non-numbers result in undefined behavior. Sounds right to me. Really, it ought to throw an exception. PHP tries to "keep going" way too often<|eor|><|eols|><|endoftext|>
7
lolphp
sloat
c545e73
<|sols|><|sot|>On behalf of PHP I would like to apologize. After carefully reviewing this bug report with our board of directors on 4chan... We will try to stop fixing bugs in PHP. [x-post from r/programming]<|eot|><|sol|>https://bugs.php.net/bug.php?id=50696<|eol|><|sor|>> We will try to stop fixing bugs in PHP. Mission accomplished.<|eor|><|eols|><|endoftext|>
6
lolphp
pixlpaste
qzupj
<|sols|><|sot|>PHP turtles<|eot|><|sol|>http://alokmenghrajani.github.com/wtf/php.html<|eol|><|eols|><|endoftext|>
29
lolphp
ealf
k9ymk
<|sols|><|sot|>To get the HTTP request headers, you call getallheaders(). To get the response headers, you call get_headers(). Or vice-versa.<|eot|><|sol|>http://us2.php.net/manual-lookup.php?pattern=getheaders&lang=en<|eol|><|eols|><|endoftext|>
30
lolphp
ealf
c2iwxk3
<|sols|><|sot|>To get the HTTP request headers, you call getallheaders(). To get the response headers, you call get_headers(). Or vice-versa.<|eot|><|sol|>http://us2.php.net/manual-lookup.php?pattern=getheaders&lang=en<|eol|><|sor|>EDIT didn't notice the request / response difference nice try, getheaders is for any web server, get_headers is apache only array getallheaders ( void ) Fetches all HTTP headers from the current request. This function is an alias for apache_request_headers(). Please read the apache_request_headers() documentation for more information on how this function works. <|eor|><|soopr|>Not sure what you're trying to say. `get_headers()` returns **response** headers. `getallheaders()` returns the **request** headers. It used to be Apache only, but they've since started supporting NSAPI and FastCGI as well (without updating the function description, which still says it's an alias for `apache_request_headers()`).<|eoopr|><|eols|><|endoftext|>
5
lolphp
ealf
c2ix8ka
<|sols|><|sot|>To get the HTTP request headers, you call getallheaders(). To get the response headers, you call get_headers(). Or vice-versa.<|eot|><|sol|>http://us2.php.net/manual-lookup.php?pattern=getheaders&lang=en<|eol|><|sor|>EDIT didn't notice the request / response difference nice try, getheaders is for any web server, get_headers is apache only array getallheaders ( void ) Fetches all HTTP headers from the current request. This function is an alias for apache_request_headers(). Please read the apache_request_headers() documentation for more information on how this function works. <|eor|><|soopr|>Not sure what you're trying to say. `get_headers()` returns **response** headers. `getallheaders()` returns the **request** headers. It used to be Apache only, but they've since started supporting NSAPI and FastCGI as well (without updating the function description, which still says it's an alias for `apache_request_headers()`).<|eoopr|><|sor|>oops, my mistake<|eor|><|soopr|>I don't blame you :-)<|eoopr|><|eols|><|endoftext|>
5
lolphp
carlos_vini
ng1u3n
<|sols|><|sot|>Array_map ignores strict_types<|eot|><|sol|>https://twitter.com/Ocramius/status/1394931673586876416?s=20<|eol|><|eols|><|endoftext|>
29
lolphp
bj_christianson
gyonh26
<|sols|><|sot|>Array_map ignores strict_types<|eot|><|sol|>https://twitter.com/Ocramius/status/1394931673586876416?s=20<|eol|><|sor|>Looks to be a result of "Strict typing applies to function calls made from within the file with strict typing enabled, not to the functions declared within that file." Since the call to `$intId` is occurring within `array_map()`, in code outside the file where strict typing was declared. I'm still considering it a LOL, since this does mean the only way to ensure there is strict typing on any function that calls another function is to implement it yourself.<|eor|><|eols|><|endoftext|>
14
lolphp
Girgias
gypyp4x
<|sols|><|sot|>Array_map ignores strict_types<|eot|><|sol|>https://twitter.com/Ocramius/status/1394931673586876416?s=20<|eol|><|sor|>Looks to be a result of "Strict typing applies to function calls made from within the file with strict typing enabled, not to the functions declared within that file." Since the call to `$intId` is occurring within `array_map()`, in code outside the file where strict typing was declared. I'm still considering it a LOL, since this does mean the only way to ensure there is strict typing on any function that calls another function is to implement it yourself.<|eor|><|sor|>The actual reason is that the function is called by the engine, in which case strict types never applies. Same happens with the function you register as an error/exception handler.<|eor|><|eols|><|endoftext|>
7
lolphp
ntzm_
dso31j
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|eols|><|endoftext|>
33
lolphp
Cozy_Conditioning
f6r5gps
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>Erratic input creates erratic output. Not sure why this is lolphp material.<|eor|><|sor|>Erratic input should create an exception.<|eor|><|eols|><|endoftext|>
23
lolphp
squiggleslash
f6s91av
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>I thought about it and this is entirely logical. The only way to interpret this is (1.) . (.1), which parses as "1, converted to a string, concatenated with 0.1, also converted to a string", it *looks strange* because PHP has chosen "." as the concatenation operator, and the results *initially* seem odd until you bear in mind that .1 will always be written out by any high level language as 0.1 when converted to a string. But, for once, I can't say this is a LOL. It's pretty much expected behavior by anyone who'd deliberately write that sequence of characters. It's amusing, sure, but every language has something like that.<|eor|><|eols|><|endoftext|>
21
lolphp
ntzm_
f6qme5a
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|soopr|>Explanation: https://twitter.com/mattbrowndev/status/1192159640471162881<|eoopr|><|eols|><|endoftext|>
11
lolphp
3dB
f6quiwh
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>Erratic input creates erratic output. Not sure why this is lolphp material.<|eor|><|eols|><|endoftext|>
11
lolphp
the_alias_of_andrea
f6rqc47
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>Well, it's a fun output, but is it unreasonable? PHP has a fairly normal C-like lexical structure, where things do not need spaces between them.<|eor|><|eols|><|endoftext|>
8
lolphp
FlyingBishop
f6t1l8s
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>I thought about it and this is entirely logical. The only way to interpret this is (1.) . (.1), which parses as "1, converted to a string, concatenated with 0.1, also converted to a string", it *looks strange* because PHP has chosen "." as the concatenation operator, and the results *initially* seem odd until you bear in mind that .1 will always be written out by any high level language as 0.1 when converted to a string. But, for once, I can't say this is a LOL. It's pretty much expected behavior by anyone who'd deliberately write that sequence of characters. It's amusing, sure, but every language has something like that.<|eor|><|sor|>> It's pretty much expected behavior by anyone who'd deliberately write that sequence of characters. Reading that with experience in Ruby I read it as (1 ... 1), which would evaluate to an empty iterator. Obviously it's PHP and that's an unreasonable interpretation, but I still think in any sane language this would be a syntax error.<|eor|><|eols|><|endoftext|>
8
lolphp
Serialk
f6rp5vx
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>Erratic input creates erratic output. Not sure why this is lolphp material.<|eor|><|sor|>Erratic input should create an exception.<|eor|><|sor|>of course it's tricky to identify this as erratic input without explicitly black-listing for it. The root of the issue is PHP's eagerness to "fix" stuff for you combined with the precedence of the . operator. Given that you don't want to explicitly blacklist the usage of ..., the only way to make this throw is to fix PHP's type conversion rules, but that would have huge backwards compatibility breaking impact. You'd end up with a better language which nobody uses, just like Python 3 which took more than 10 years to get majority adoption and still people are talking about 2.7 totally being good enough and the upgrade to 3 not being worth the hassle.<|eor|><|sor|>>of course it's tricky to identify this as erratic input without explicitly black-listing for it. That's not how grammars work buddy.<|eor|><|eols|><|endoftext|>
7
lolphp
barubary
f6rr3fi
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>Well, it's a fun output, but is it unreasonable? PHP has a fairly normal C-like lexical structure, where things do not need spaces between them.<|eor|><|sor|>> PHP has a fairly normal C-like lexical structure Except for single-line comments and double-quoted strings, the latter especially being bonkers. But I agree that the outcome of this particular example is not very surprising with a normal "maximal munch" lexer.<|eor|><|eols|><|endoftext|>
6
lolphp
pilif
f6rqg26
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|sor|>Erratic input creates erratic output. Not sure why this is lolphp material.<|eor|><|sor|>Erratic input should create an exception.<|eor|><|sor|>of course it's tricky to identify this as erratic input without explicitly black-listing for it. The root of the issue is PHP's eagerness to "fix" stuff for you combined with the precedence of the . operator. Given that you don't want to explicitly blacklist the usage of ..., the only way to make this throw is to fix PHP's type conversion rules, but that would have huge backwards compatibility breaking impact. You'd end up with a better language which nobody uses, just like Python 3 which took more than 10 years to get majority adoption and still people are talking about 2.7 totally being good enough and the upgrade to 3 not being worth the hassle.<|eor|><|sor|>>of course it's tricky to identify this as erratic input without explicitly black-listing for it. That's not how grammars work buddy.<|eor|><|sor|>no. it's not. but it's what you would need to do in order to make this throw an exception without changing either the . operator precedence or the crazy type conversion rules in PHP. Doing any of those would be a backwards compatibility break with a huge surface and very little means for detecting.<|eor|><|eols|><|endoftext|>
6
lolphp
colshrapnel
f6ruase
<|sols|><|sot|>What's the output of 1...1? The answer might surprise you<|eot|><|sol|>https://3v4l.org/YNjsZ<|eol|><|soopr|>Explanation: https://twitter.com/mattbrowndev/status/1192159640471162881<|eoopr|><|sor|>[deleted]<|eor|><|sor|>Errr... Why not?<|eor|><|eols|><|endoftext|>
5
lolphp
cleeder
b6knxs
<|sols|><|sot|>Whats the most fucked up thing you've done for money? PHP.<|eot|><|sol|>https://www.reddit.com/r/AskReddit/comments/b6ccgh/whats_the_most_fucked_up_thing_youve_done_for/ejjlpm5/?st=jtstyas0&sh=87dc0d97<|eol|><|eols|><|endoftext|>
31
lolphp
soton91
7guo0c
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|eoss|><|endoftext|>
28
lolphp
BillyIII
dqm3w8a
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>IMHO any language that has zero-cost abstractions, move semantics, guaranteed memory safety, threads without data races, trait-based generics, pattern matching, type inference, minimal runtime and efficient C bindings would be a good fit. Out of the languages that have these features you can choose whichever you are most comfortable with. <|eor|><|eoss|><|endoftext|>
130
lolphp
Serialk
dqmky3z
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>This isn't the right place, but just to give you a hint: a lot of the problems we discuss here stem from the loose typing rules php has and how hard it is to enforce proper typing because of lack of consideration for orthogonality. Consider Facebook: they were php-based and added a proper and enforceable typing system on top. You see this trend in other dynamic programming languages, like python (type annotations with optional static checks) or javascript (typescript). So the future seems to be static typing for languages with functional aspects. Being comfortable with higher-order typing in any language that supports it seems like one of the promising ways forward.<|eor|><|sor|>What type issues does PHP 7.2 have?<|eor|><|sor|>[Oh, nothing.](https://3v4l.org/GHf2J)<|eor|><|eoss|><|endoftext|>
59
lolphp
ThereIsNoDana-6
dqm4z4z
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>IMHO any language that has zero-cost abstractions, move semantics, guaranteed memory safety, threads without data races, trait-based generics, pattern matching, type inference, minimal runtime and efficient C bindings would be a good fit. Out of the languages that have these features you can choose whichever you are most comfortable with. <|eor|><|sor|>I'd argue you should add 6-week release cycle and Fearless Concurrency to this list. But yeah OP, you only really need these features. After that you can choose freely from all the available options.<|eor|><|eoss|><|endoftext|>
48
lolphp
Serialk
dqmm10b
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>This isn't the right place, but just to give you a hint: a lot of the problems we discuss here stem from the loose typing rules php has and how hard it is to enforce proper typing because of lack of consideration for orthogonality. Consider Facebook: they were php-based and added a proper and enforceable typing system on top. You see this trend in other dynamic programming languages, like python (type annotations with optional static checks) or javascript (typescript). So the future seems to be static typing for languages with functional aspects. Being comfortable with higher-order typing in any language that supports it seems like one of the promising ways forward.<|eor|><|sor|>What type issues does PHP 7.2 have?<|eor|><|sor|>[Oh, nothing.](https://3v4l.org/GHf2J)<|eor|><|sor|>Well done, you used type coercion. If you don't want type coercion, use the correct operator.<|eor|><|sor|>"The toolbox can do anything, it's your fault for choosing a tool that looks reasonable and that everyone uses but that is only useful to shoot yourself in the foot" But okay, let's say you're right and it's my fault for using the dumbest, most dangerous and useless feature you could possibly imagine in a language. So tell me then, what's the equivalent of < <= >= and > that don't do type coercion?<|eor|><|eoss|><|endoftext|>
43
lolphp
maweki
dqltgjn
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>This isn't the right place, but just to give you a hint: a lot of the problems we discuss here stem from the loose typing rules php has and how hard it is to enforce proper typing because of lack of consideration for orthogonality. Consider Facebook: they were php-based and added a proper and enforceable typing system on top. You see this trend in other dynamic programming languages, like python (type annotations with optional static checks) or javascript (typescript). So the future seems to be static typing for languages with functional aspects. Being comfortable with higher-order typing in any language that supports it seems like one of the promising ways forward.<|eor|><|eoss|><|endoftext|>
37
lolphp
cfreak2399
dqlya2h
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Python is everywhere. Web, automation, data science. Python is a joy to learn and it has many of the pros of PHP by being dynamic but the sanity of a clean standard library and strong types when you need them.<|eor|><|eoss|><|endoftext|>
29
lolphp
dotancohen
dqujgmg
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>IMHO any language that has zero-cost abstractions, move semantics, guaranteed memory safety, threads without data races, trait-based generics, pattern matching, type inference, minimal runtime and efficient C bindings would be a good fit. Out of the languages that have these features you can choose whichever you are most comfortable with. <|eor|><|sor|>[deleted]<|eor|><|sor|>No, Rust. That description is right from the official Rust website. https://www.rust-lang.org/en-US/<|eor|><|eoss|><|endoftext|>
24
lolphp
mardukaz1
dqnou3n
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>This isn't the right place, but just to give you a hint: a lot of the problems we discuss here stem from the loose typing rules php has and how hard it is to enforce proper typing because of lack of consideration for orthogonality. Consider Facebook: they were php-based and added a proper and enforceable typing system on top. You see this trend in other dynamic programming languages, like python (type annotations with optional static checks) or javascript (typescript). So the future seems to be static typing for languages with functional aspects. Being comfortable with higher-order typing in any language that supports it seems like one of the promising ways forward.<|eor|><|sor|>What type issues does PHP 7.2 have?<|eor|><|sor|>[Oh, nothing.](https://3v4l.org/GHf2J)<|eor|><|sor|>Well done, you used type coercion. If you don't want type coercion, use the correct operator.<|eor|><|sor|>"The toolbox can do anything, it's your fault for choosing a tool that looks reasonable and that everyone uses but that is only useful to shoot yourself in the foot" But okay, let's say you're right and it's my fault for using the dumbest, most dangerous and useless feature you could possibly imagine in a language. So tell me then, what's the equivalent of < <= >= and > that don't do type coercion?<|eor|><|sor|>```strcmp()```, ```strncmp()```, ```strcasecmp()```?<|eor|><|sor|>my god<|eor|><|eoss|><|endoftext|>
18
lolphp
cfreak2399
dqmqm3i
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Python is everywhere. Web, automation, data science. Python is a joy to learn and it has many of the pros of PHP by being dynamic but the sanity of a clean standard library and strong types when you need them.<|eor|><|sor|>[removed]<|eor|><|sor|>LOL. I guess we'll just ignore PHP's weird breaking changes between _minor_ versions. But yeah there are two versions of Python. Supporting both is actually really easy as there are modules that back-port the changes. Those differences are also really well documented so it's not really that big of a deal. One my current projects is to port some 2.7 code to be compatible with 3.x. I was dreading it but it turned out to be really simple.<|eor|><|eoss|><|endoftext|>
17
lolphp
carbolymer
dqnh51v
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Listen, this is coming from a PHP hater, so take it with a grain of salt, but my advice is this: if you like PHP, stick with it for now. I moved to Go and absolutely **love it**, however even Go's own blog https://blog.golang.org/8years shows that it's still way behind PHP usage. My point is that there's no immediate cliff you have to be worried about running into any time soon. However, if you wanted to learn a new language for the sake of expanding your skillset, i'd say Go, hands down. <|eor|><|sor|>Go for Go<|eor|><|sor|>Lol no generics<|eor|><|eoss|><|endoftext|>
17
lolphp
nikomo
dqmoi78
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Python is everywhere. Web, automation, data science. Python is a joy to learn and it has many of the pros of PHP by being dynamic but the sanity of a clean standard library and strong types when you need them.<|eor|><|sor|>[removed]<|eor|><|sor|>Honestly, it's a feature nowadays. I don't want to depend on something that hasn't been maintained for roughly 6 or more years. Python 3.2 came out in 2011, and that's pretty much the point where Python 3 was essentially deemed usable for work. If it's not supported in Python 3 by now, it's because it was obsoleted by something better (standard library or another project), or because it's dead. Sucks for maintaining legacy code, but it's nice for development.<|eor|><|eoss|><|endoftext|>
16
lolphp
graingert
dqlx4ux
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Haskell<|eor|><|eoss|><|endoftext|>
15
lolphp
Serialk
dqnqemx
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>This isn't the right place, but just to give you a hint: a lot of the problems we discuss here stem from the loose typing rules php has and how hard it is to enforce proper typing because of lack of consideration for orthogonality. Consider Facebook: they were php-based and added a proper and enforceable typing system on top. You see this trend in other dynamic programming languages, like python (type annotations with optional static checks) or javascript (typescript). So the future seems to be static typing for languages with functional aspects. Being comfortable with higher-order typing in any language that supports it seems like one of the promising ways forward.<|eor|><|sor|>What type issues does PHP 7.2 have?<|eor|><|sor|>[Oh, nothing.](https://3v4l.org/GHf2J)<|eor|><|sor|>Well done, you used type coercion. If you don't want type coercion, use the correct operator.<|eor|><|sor|>"The toolbox can do anything, it's your fault for choosing a tool that looks reasonable and that everyone uses but that is only useful to shoot yourself in the foot" But okay, let's say you're right and it's my fault for using the dumbest, most dangerous and useless feature you could possibly imagine in a language. So tell me then, what's the equivalent of < <= >= and > that don't do type coercion?<|eor|><|sor|>[deleted]<|eor|><|sor|>The arguments are ALREADY BOTH STRINGS. There is a canonical total ordering between strings, it's called "lexicographical order". You don't need to "define" anything. Every language that does comparison of strings know how to do it except php.<|eor|><|eoss|><|endoftext|>
14
lolphp
cfreak2399
dqszrww
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Python is everywhere. Web, automation, data science. Python is a joy to learn and it has many of the pros of PHP by being dynamic but the sanity of a clean standard library and strong types when you need them.<|eor|><|sor|>I personally really don't find Python attractive over PHP, it brings nothing to be, there is still that Python 2 vs. Python 3 mess and it's actually more loose than PHP regarding strict typings. I perfectly understand people being comfortable with Python, but if I switch of language (and I am learning other languages, anyone should) it's certainly not gonna be for Python.<|eor|><|sor|>What makes you say that types are less strict in Python? Consider this code: <?php $foo = 10 + "10asdf"; echo $foo; # echos 20 ?> And in Python: 10 + "10asdf" Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unsupported operand type(s) for +: 'int' and 'str' (note that Python still complains even if you do "10" + 10.) The only time they are _remotely_ similar in type handling is with the print function in Python will always print a string representation of an object but even that is controllable through the \_\_repr__ method. But to each their own. If you think PHP is better, knock yourself out. <|eor|><|eoss|><|endoftext|>
13
lolphp
mardukaz1
dqm006j
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Regarding Vue - just looked it up and after working with Angular I just want to blow my brains out because Vue is one of those shit frameworks that have bullcrap like html attributes - "v-bind", "v-if", "v-for"... Why. > <button v-on:click="reverseMessage"> Just why. Be more like React and just use fucking javascript.<|eor|><|eoss|><|endoftext|>
12
lolphp
occz
dr5bqzk
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>Python is everywhere. Web, automation, data science. Python is a joy to learn and it has many of the pros of PHP by being dynamic but the sanity of a clean standard library and strong types when you need them.<|eor|><|sor|>Python is great until someone decides to change the number of spaces in a tab, resulting in compile errors everywhere. <|eor|><|sor|>Has anyone ever had a problem with this in the real world? I've been developing python both privately and professionally and this has literally never happened to neither me nor my colleagues - legit all tooling handles this flawlessly.<|eor|><|eoss|><|endoftext|>
12
lolphp
mardukaz1
dqnotlj
<|soss|><|sot|>If everyone 'hates' PHP, what language next?<|eot|><|sost|>Not sure if this is the right place but... Currently full stack and most projects are Laravel / Vue based. ALOT of people dislike PHP / Laravel but whats the suggestion on a language to learn that is future proof and well supported by job roles?<|eost|><|sor|>This isn't the right place, but just to give you a hint: a lot of the problems we discuss here stem from the loose typing rules php has and how hard it is to enforce proper typing because of lack of consideration for orthogonality. Consider Facebook: they were php-based and added a proper and enforceable typing system on top. You see this trend in other dynamic programming languages, like python (type annotations with optional static checks) or javascript (typescript). So the future seems to be static typing for languages with functional aspects. Being comfortable with higher-order typing in any language that supports it seems like one of the promising ways forward.<|eor|><|sor|>What type issues does PHP 7.2 have?<|eor|><|sor|>[Oh, nothing.](https://3v4l.org/GHf2J)<|eor|><|sor|>christ There are worse things than JavaScript out there.<|eor|><|eoss|><|endoftext|>
12
lolphp
iheartrms
75rcq5
<|sols|><|sot|>"Open Source Password Manager written in PHP for business and personal use." - What could go wrong?<|eot|><|sol|>https://www.syspass.org/index-en.html<|eol|><|eols|><|endoftext|>
27
lolphp
DoctorWaluigiTime
do8mkbh
<|sols|><|sot|>"Open Source Password Manager written in PHP for business and personal use." - What could go wrong?<|eot|><|sol|>https://www.syspass.org/index-en.html<|eol|><|sor|>This has nothing to do with PHP. This is just /r/shittyprogramming.<|eor|><|eols|><|endoftext|>
42
lolphp
iheartrms
do8bd2d
<|sols|><|sot|>"Open Source Password Manager written in PHP for business and personal use." - What could go wrong?<|eot|><|sol|>https://www.syspass.org/index-en.html<|eol|><|soopr|>https://www.google.com/search?q=syspass+vulnerabilities SQL injection, remote command execution, cryptographic security bypass, the usual issues.<|eoopr|><|eols|><|endoftext|>
34
lolphp
DoctorWaluigiTime
do8rpur
<|sols|><|sot|>"Open Source Password Manager written in PHP for business and personal use." - What could go wrong?<|eot|><|sol|>https://www.syspass.org/index-en.html<|eol|><|sor|>This has nothing to do with PHP. This is just /r/shittyprogramming.<|eor|><|sor|>Saying all languages have shitty programmers is like saying "all lives matter". Sure they do, but there's something about PHP particularly which attracts shitty programmers. I expect that the author of the aforementioned would take issue with your characterization that he is a shitty programmer because that is what pretty much all PHP programmers do. He probably even considers himself a "software engineer" and might actually even hold that title somewhere.<|eor|><|sor|>Good thing I didn't say that all languages have shitty programmers. (Although that's a true statement.) It's just that "here's a project written in PHP that has problems" is not /r/lolphp material. It doesn't have anything to do with the language's quirks. It's just a project with problems.<|eor|><|eols|><|endoftext|>
18
lolphp
mort96
do99676
<|sols|><|sot|>"Open Source Password Manager written in PHP for business and personal use." - What could go wrong?<|eot|><|sol|>https://www.syspass.org/index-en.html<|eol|><|sor|>This has nothing to do with PHP. This is just /r/shittyprogramming.<|eor|><|sor|>Saying all languages have shitty programmers is like saying "all lives matter". Sure they do, but there's something about PHP particularly which attracts shitty programmers. I expect that the author of the aforementioned would take issue with your characterization that he is a shitty programmer because that is what pretty much all PHP programmers do. He probably even considers himself a "software engineer" and might actually even hold that title somewhere.<|eor|><|sor|>Good thing I didn't say that all languages have shitty programmers. (Although that's a true statement.) It's just that "here's a project written in PHP that has problems" is not /r/lolphp material. It doesn't have anything to do with the language's quirks. It's just a project with problems.<|eor|><|sor|>To demonstrate that security critical open-source and self-hosted PHP applications aren't necessarily terrible, just look at Nextcloud: https://github.com/nextcloud/server<|eor|><|eols|><|endoftext|>
5
lolphp
BilgeXA
6cxkp4
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|eols|><|endoftext|>
29
lolphp
Schmittfried
dhyl6nu
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>Why shouldn't it be? There are some situations where a parent class might want to call something in a child. The most common would be overridden methods. Would you prefer it if they were a special case?<|eor|><|sor|>If the base class needs to call methods of the child class, those should either be public or declared in the base class. Protected methods of the child class that were not declared in the base class must be considered an implementation detail of the child class in context of the base class -> it shouldn't be accessible.<|eor|><|eols|><|endoftext|>
19
lolphp
Schmittfried
dhyl2z6
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>[deleted]<|eor|><|soopr|>You seem very smart. What should happen if it's `private` instead of `protected`, and why?<|eoopr|><|sor|>[deleted]<|eor|><|sor|>What you quoted is in fact not a lolphp, but proper OO behavior. Private only means that other classes cannot access those fields. It would be absurd to forbid other instances of the same class to access those fields as it would make code unnecessarily complicated in several cases without providing any advantage at all. Other objects of the same class use the very same implementation, so of course that implementation should be able to access its implementation details. The lolphp here is that the visibility granted by `protected` seems to go in both directions of the hierarchy although it should make the field only visible to child classes.<|eor|><|eols|><|endoftext|>
15
lolphp
scatters
dhz3hxg
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>That example works in Java, and C++, although there are slightly different reasons. Java: all classes which are part of the same package will have access to each other's protected methods. C++: access rules are per class, not per object. So any object of same class can access other's privates.<|eor|><|sor|>C++: [uh](https://godbolt.org/g/rkeFxX)<|eor|><|eols|><|endoftext|>
12
lolphp
FlyLo11
dhyz2y6
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>That example works in Java, and C++, although there are slightly different reasons. Java: all classes which are part of the same package will have access to each other's protected methods. C++: access rules are per class, not per object. So any object of same class can access other's privates.<|eor|><|eols|><|endoftext|>
7
lolphp
prema_van_smuuf
dhy5mot
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>Well, what did you expect?<|eor|><|eols|><|endoftext|>
7
lolphp
barubary
dhzahdi
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>Well, what did you expect?<|eor|><|sor|>An error, because `protected` methods should only be available in subclasses.<|eor|><|eols|><|endoftext|>
7
lolphp
BilgeXA
dhy7u8s
<|sols|><|sot|>Why is this allowed? (Inverse inheritance)<|eot|><|sol|>https://3v4l.org/qLedW<|eol|><|sor|>[deleted]<|eor|><|soopr|>You seem very smart. What should happen if it's `private` instead of `protected`, and why?<|eoopr|><|sor|>[deleted]<|eor|><|soopr|>It's not *very well* documented. If the method is `private` inheritance doesn't apply. But if it's `protected`, inheritance works both ways, i.e. backwards, to the parent. This appears to be entirely undocumented.<|eoopr|><|eols|><|endoftext|>
7