« first day (3813 days earlier)      last day (1126 days later) » 
00:00 - 16:0016:00 - 23:00

4:00 PM
can't really imagine a good excuse for arrow functions other than short typing in PHP and if use is used then I think it's pretty pointless ?
 
I think it's more concise than function() use ($a, $b) { return .... }
 
apologies if this has been explained before, or if this is a RTFM question, but what is "auto-capture"?
 
variables which live outside of the scope of the function @Tiffany
 
Imagine

$a = 1;
$foo = function() {
echo $a;
};

=> 1

But in PHp as it is, $a is outside the scope, so echo $a is empty
 
^ exactly
 
4:02 PM
@Tiffany Where a closure/anon function has access to a variable in its lexical scope (it is "captured") without you having to specify explicitly.
Basically what fn() does, and function() does not.
 
Interesting
 
Which is exactly the point why it is awkward
one captures the other doesn't
 
@Crell I would say that the best we can do is make code be maintainable. That means maximizing readability through explicit syntax.
 
@Sara I would disagree that manual capture maximizes readability in all cases. Even most cases.
 
I'm not suggesting manual capture.
I'm suggesting explicit auto capture.
 
4:05 PM
Wasn't the whole point that fn() was to be only syntax sugar for function() ...
i.e: a shorter way to type anonymous functions ?
 
28 mins ago, by Sara
fn() => expr is a shorthand sugar for function() use(*) { return expr; } IMO
 
@Sara Sure, but that's still extra visual clutter, which harms readability.
 
if so, why would the behavior change if I use one or another?
@Sara I agreed when I saw it but now I'm asking myself why should the behavior change
 
@Crell That's an absurdist argument. You can do better than that.
 
@ln-s Yes and no. On the one hand, it took a very common pattern for closures and made it simpler. On the other, it allows for a much more expression-oriented way of thinking, especially when inlining an anon function. Which of those is more valuable is a subjective question.
(I'm skimming over the original lambda thread that someone linked to, and it's fascinating to see what the discussion was. And that I was involved in it. :-) )
 
4:08 PM
And I guess that the problem resides in this yes/no
()(*) => return $a+1;

no fn no use
 
Impossible in the lexer. Nikita tried. If that would have worked, we'd have used that instead of fn. :-)
 
Looks like cheap silicone implants if you ask me but hey
"Hey you got a flat!"
 
funtion() use($foo, $bar) { I hated the manual typing from day one.
 
nit; Not impossible, just quite difficult and not worth the hacks it'd take
 
"Nikita said it's way too hard to bother with" is close enough to impossible for common usage. :-)
 
4:11 PM
:D
 
Maybe it shouldn't be bothered at all and left for another iteration
 
@ln-s Because ages ago when closures were added to PHP, they thought explicit capture was a good idea. I'm not saying they are wrong, but we can point to a large body of evidence that suggests auto-capture is better liked.
 
Better liked does not necessarily mean better.
 
It goes hand by hand with less typing
 
Yes. We write programs for a living. God forbid we type things.
 
4:17 PM
Oh shit did I had to type function
I'm so tired
I kid
 
PHP supports [] already, maybe time to allow () => {}, and () => [] as well (instead of prefixing that with fn). Is not backward compatible?? maybe add feature enabler like <?php //@implicit
 
@Top-Master It was already stated that it takes too much work and that is not worth the trouble
 
php dynamic functions already capture the $this like () => { } does in JS
 
You are right, I always forgot to add Option explicit on top of each VBA file (for example, so forget about //@implicit).
 
@Top-Master No, the parser can't differentiate between () => expr and various other places where () is used.
 
4:23 PM
yellow!
 
The probably most desired syntax for arrow functions is ($x) => $x * $y or $x => $x * $y for short. It is very concise, and used by a number of other programming languages, including JavaScript. However, using this syntax in PHP comes with some severe technical challenges. This section will discuss a number of possible syntaxes for arrow functions and what benefits and disadvantages they have.
Yeah
So why do it if fn() is going to be used instead, needs another iteration IMO
 
@gustavoanalytics those are two queries, not one
 
4:26 PM
also why set, in the name of the lord
 
wehre!
what?
 
SET @User_id = (SELECT user_id FROM caffeine_customers_shipping_addresses WHERE id = 4650);
What is that ???
 
@ln-s don't be a dick. just write it as you would, then say "I would write it like this:"
 
Nah not a dick, he just has to do two queries
:)
 
4:32 PM
@gustavoanalytics googling "mysql_fetch_array() expects parameter 1 to be resource, boolean given", gives the result of: stackoverflow.com/questions/11674312/…
 
So that should set the @User_id variable to the value of user_id from caffeine_customers_shipping_addresses where the id is 4650
C@Danack yes and they where none helpful as my query works on Sequel Pro but not in php
 
clicking through leads to: stackoverflow.com/a/2973209/778719 which says how to find the error in your query.
 
```
SET @User_id = (SELECT user_id FROM caffeine_customers_shipping_addresses WHERE id = 4650);
SELECT * FROM caffeine_customers_shipping_addresses WHERE user_id=@User_id
```
that works in Sequel Pro
 
You don't need to say the same info again. You need to read the answer, and figure out how to debug it on your machine. We aren't a debugging service.
"that works in Sequel Pro" So?
 
and doesnt work in PHP
 
4:34 PM
touche!
I kid :P
 
2 messages moved to Trash can
not in the mood.
 
Sorry
 
A Java conference is trying to get me to host/moderate a track.

I am so very confused.
 
@gustavoanalytics if it works on one machine, and doesn't work on another, you need to use the appropriate function to get the error, on the machine that it doesn't work on.
if($result === FALSE) {
    die(mysql_error()); // TODO: better error handling
}
 
perfect!
thank you
 
4:37 PM
that was in the link.
 
1) mysql_query is deprecated
2) the legacy mysql library does not allows for two queries in one sentence (AFAICR)
3) Why would one use SET @User_id?
 
which I guess you didn't read.
 
if (function_exists('mysql_query')) throw new WhatVersionOfPhpEvenIsThisError();
 
@ln-s because they haven't learnt about joins yet...
 
1. im on legacy program
 
4:37 PM
Inside of PHP ...
 
and i definitely have not learned about joins
:)
 
Doesn't matter gustavo, you can make two queries it's not that hard, even if you know nothing about joins, read point 2
 
ahhhhhhhh
point 2 is very valid
 
:ok_hand:
 
thanks!
 
4:39 PM
np
(Plus I wasn't trying to be a dick really, I just got startled like a feral animal)
 
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT * FROM caffeine_customers_shipping_addresses WHERE user_id=@User_id' at line 1
rofl
 
1) mysql_query('SET @User_id=1239213'); //Check for false, etc
2) $result = mysql_query('SELECT .... where user_id=@User_Id');
3) Even tho you don't need point 1 at all, you can just do $result = mysql_query('SELECT .... where user_id=1234');
 
Using SET with any database inside PHP code is already a bad code smell
 
not sure about that statement at all...
 
4:43 PM
One could argue
 
for some reason I use that by far and way most frequently in SQL Server, occasionally in pg, never in mysql
 
But couppling a functionality such as SET in PHP code will probably leave with a problem or two when trying to switch to redis or some other storage engine of your liking
 
SQL Server is better at query optimisation with declared vars than parameterization, for some reason
 
Can you hack your way out, sure
 
4:45 PM
> trying to switch to
this is the great lie of web development
 
Methinks the RM selection process this time around is desperately crying out for an RCV style vote.
 
people never, ever change data back ends, it just doesn't happen
 
Should you do it? Well, same reason if you should shoot yourself in the face
I have
Parts of the search I've switched them to elastic
 
I wouldn't mind an elastic face
 
session handling to redis instead of mysql
haha
Mickey Rourke agrees
 
4:47 PM
@ln-s this really does not read like you intended I suspect, in combination with the previous message...
 
$result = mysql_query("SET @User_id = (SELECT user_id FROM caffeine_customers_shipping_addresses WHERE id = 4650)");


gives me true yay
 
right, you have to stop using mysql_query() right now
please
 
haha :)
 
it's not available on 7 afaik ?
so he must be on 5 something
 
it was deprecated in 5.5 iirc and removed from core in 7
 
4:48 PM
yeah
 
and mysqli and pdo have been available since forever
 
mysqli is the next on the list (I hope?)
 
I really hope there isn't a lot of PHP5 left in the world being used in anger
 
this site is 13 years old
and the owners DO NOT want to upgrade
even though they are north of 1million a year
 
Ouch
 
4:49 PM
OK so personally my response to that is "OK find someone else to maintain this shit then"
 
because that is not how the world works
 
@DaveRandom Sure, tell that to the traffic system in Jersey
 
what if you ran rm -rf /, what they gonna do then?
 
"Why you should code in COBOL?"
Yeah no dude, thanks hard pass from me hommie
 
4:50 PM
(don't, I just mean they have no disaster plan)
 
or to banks
 
that is not maintainable, and people like that are probably going to take a long time to not pay you what they owe you anyway
walk away and never look back, that's my advice :-P
 
actually they pay on time and never missed a payment
 
well, good for them
sorry I seem to be in quite a shitty mood, I shall go away and come back later :-P
 
4:56 PM
this guy
 
eiiiiiiiiiiii, this guy
he's got jokes
 
1 message moved to Trash can
 
You gotta take a stand.
When you are dealing with legacy code like that.
 
not my call im just the peon
 
The owner does not know that simply by improving the code the developer's life will be a lot less stressful.
 
5:16 PM
hola amigos
 
 
5:32 PM
\o
 
o/
 
ut oh, internals ML turned into a few-user spamfest again
 
The fn topic ?
 
yeah
 
xD
 
5:40 PM
has the bikeshedding begun?
 
Yep. And Mike Schinkel is involved.
Unfortunately he's arguing pro-fn(), which is probably harmful toward it passing. :-/
@NunoMaduro I think it would be good to include some tests based on Rowan's examples to confirm exactly what happens. I'm pretty sure what happens is entirely logical, but tests to confirm would be good.
 
@Tiffany not even that useful.....
 
hmm ...
 
@Danack when bikeshedding can be considered more useful ... D:
 
I'm not really sure what we win by taking away some typing ...
 
5:47 PM
Mainly a bunch of noise that can (and does) distract from the primary function of the code.
 
Or maybe this ?
 
you know that how clean the code looks is totally subjective, if I have to spend longer than a millisecond determining which expression are functions, it feels like loosing to me ...
you shouldn't care, because it's subjective, but you can't use apparent (to you) clarity to make the argument that some code is better ...
 
< insert functional programming argument >
I'm personally pro ()=> I mean, if you are trying to mimic something, do it well
If it becomes a bike shed, don't let it pass, leave it for later until it has matured
 
@Crell says draft on the document
 
@Crell I've just added tests concerning the usage combined with the "match" feature. https://github.com/php/php-src/pull/6246/commits/408b1344a81d51de67618ccba334691da8492094.

Checking now Rowan's examples...
@Crell You are referring to this one? externals.io/email/113787/source
 
5:58 PM
@NunoMaduro Yep, that's the one.
@JoeWatkins Updated, thanks.
@NunoMaduro One of the examples should include the autocapture functionality.
 
6:41 PM
I just read that PHP 7.2 is no longer supported for security releases
Debian stable is still at PHP 7.3, should I be concerned?
 
Many repos backport security fixes for years after PHP officially ends supporting them
But the PHP project itself only has resources to support each one for 3 years
 
wow that sounds great but kinda concerning at the same time
i would never want to be the guy who backports security fixes lol
 
It's rare for something really bad to come along, still it's worth trying to stay with the officially supported versions
 
security patches are usually simple, and maintainers of OSes are really good at this kind of work
 
@beberlei nice then!
 
6:50 PM
can I post my stackoverflow link here? I'm having trouble implementing a flow on stripe and would appreciate the help
:D
 
sure
idk if I can help tho lol
 
0
Q: Stripe freezing a membership

Sand EepThe flow of the code allows a subscription to be frozen for an X amount of months. Would there be anyway to set this up without dealing with cancelling a subscription and restarting it with a future date? Right now I have it implemented with $temppause= $stripe->subscriptions()->update($stripe_c...

 
These kinds of questions feel like asking about how to use nmap on a C channel because nmap was made in C
 
@SandEep as long as you don't expect chat to be a fast track to a resolution. Your question was posted a few minutes ago, so you should wait and see if anyone answers on main. Patience.
 
I'm not expecting a fast track resolution, I was just checking if someone had previous experience with stripe, didn't mean it to seem like I was trying to get it fast tracked sorry ! :)
 
 
1 hour later…
8:04 PM
@Crell Just saw this comment "Do we have a test in your PR to verify the instant-execute multiline expression syntax?". Do you still need me to answer this?
 
Good afternoon my friends.

I need htaccess to identify the domain name and force the use of htts.

Is this procedure correct?
RewriteEngine on

#Forçar uso do HTTPS
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ %{HTTP_HOST}/$1 [R,L]

# Mudar domínio para HTTPS
RewriteCond %{HTTP_HOST} ^%{HTTP_HOST}$
RewriteRule (.*) %{HTTP_HOST}/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d [OR]

ErrorDocument 404 %{HTTP_HOST}
 
@Tiago This is not the Apache room. This is the PHP room. Sorry for the confusion.
 
@Sara Metal
lol
You kind of sound like a metal person are you a metal person ?
 
8:25 PM
Not in general, but when I'm really trying to focus on code I've been known to play thrash metal.
I've got Dragonforce: Inhuman Rampage on speed dial
 
Oh man
Exodus ?
Man that gig at Wacken 2008 with Rob Dukes
Highly recommend
The pit at 58:00 is amazing
 
8:51 PM
Metalcore + Japanese pop = youtube.com/watch?v=fKyXvNkGQKc
 
Not bad
 
I'm a big BMTH fan. The last album was amazing front to back.
 
I used to enjoy Moi Dix Mois (regarding japanese bands)
I like BMTH
Perhaps I should share this jewel I found not so long ago
@Sara Talk about crossdressing
 
@ln-s I'm also a big Starset fan. Most of their songs are about space or science in some way.
 
Djenty I like it
@Trowski youtube.com/watch?v=t6q2pNlYoBE Maybe you will like this guy
 
9:03 PM
@ln-s Yeah, that's pretty good.
 
9:13 PM
interesting
 
@NunoMaduro I'm honestly a little worried about advertising fn for usage in match, in that people will say that's "close enough" if we propose proper match blocks...
Also, with fn it's impossible to capture by reference so it will behave very differently than a normal block.
This can happen very quickly. E.g. transform a switch statement to match with a block where you modify some local variable outside of the switch, and already you triggered the problem.
 
user14853506
9:56 PM
Hey, this is my first time here, I've been wondering, if I just set a variable in the PHP code rather then in the database, is it still secure?
 
user14853506
Sorry, I SUCK at PHP and databases
 
user14853506
Like this I guess
 
@IluTov You mean the example on the RFC itself?
 
@ButWhyTho1375 I strongly recommend not storing anything like a secret in code. It sounds like you're trying to do password validation. Using the php.net/manual/en/function.password-verify.php is almost certainly the right thing to use if you are.
 
user14853506
@Danack thanks :)
 
10:05 PM
@ButWhyTho1375 I sincerely hope that isn't an actual password that you pasted
 
@NunoMaduro I've only looked at the examples from the RFC now but yeah, like that one. I'm not saying the behavior is wrong necessarily, just that I don't think it's a good solution for match. Match to me is a branching control structure. You wouldn't expect if blocks to have their own scopes that capture values only by value.
 
Anyone can tell me the simplest way of generating a backtrace on osx?
 
@IluTov Right - thanks for the feedback; Going to share that with @crell.
 
oh....apparently it takes a few minutes for them to be written to ~/Library/Logs/DiagnosticReports/
 
user14853506
10:27 PM
@Tiffany oh, absolutely not, just a demo that i'll never use in production
 
@ButWhyTho1375 even so, you can redact the password in this scenario, and it wouldn't affect the question, or the ability/difficulty of answering the question
99.9999999% of the time, redact the password. There are a small handful of situations where leaving the password is necessary, but even then it should be over a secured channel, at minimum.
Even if it's something that's throwaway, it's a good habit to follow. What happens if you become used to sending a password over plaintext, and you happen to share a password that shouldn't be? onosecond
 
user14853506
10:58 PM
Good point.
 
00:00 - 16:0016:00 - 23:00

« first day (3813 days earlier)      last day (1126 days later) »