« first day (1949 days earlier)      last day (3224 days later) » 

12:00
I meant the real one
I wouldn't want to commit to something catchable
@bwoebi We should discuss the issue with yield in closed generator with @BenjaminGruenbaum and @MadaraUchiha, I remember they had some thoughts about that wrt handling in JS
@NikiC the thought was to have it catachable outside of the Throwable inheritance…
@bwoebi Don't you dare even think about that
=D
@NikiC Aren't Generators in JS just outright aborted without any jumping back in?
@bwoebi I'm not sure. They may have a generator closing exception
Just remember some discussion about close() on generators
@bwoebi But in any case, I don't see the way around having at least the dummy exception. Do you?
Unless we want to introduce some more special handling for fast rets ^^
12:10
Morning o/
Manual checks for (EX(func)->op_array.fn_flags & ZEND_ACC_GENERATOR) != 0 && (zend_get_running_generator(execute_data)->flags & ZEND_GENERATOR_FORCED_CLOSE would work too, but dummy exception is better I think
I just wonder whether it will become accessible via $ex->getPrevious() …
@bwoebi Did I ever mention that I hate C bitwise operator precedence?
@NikiC yes. sigh.
I'm not a fan of useless parenthesis, but I always have to (((()))) the hell out of those
(I also love it to spend one hour debugging an issue because I directly returned flags & XYZ as a boolean)
@NikiC yeah, fun.
12:22
@bwoebi Will you take care of the finally issue?
@NikiC thought we wanted to discuss first? Or do you mean fix only the first case with an uncatchable dummy exception?
If the latter, then I can… (afk, lunch)
the latter
user924016
On getmxxr( .. ) the third arg is a array which is filled with the results "weight" ... on valid hosts it returns a array of numbers.. like 10, 20 ... what is that?
user924016
the weight..
hii!!!
12:29
@NikiC @bwoebi sup
@NikiC is it possible to make the optional also allow question mark in fast route ??
@MadaraUchiha Hey. We were talking about how generators that have been destroyed without being fully consumed should behave wrt finally blocks. Basically the interesting case is what happens if you destroy a generator, thus trigger execution of a finally block inside it, but that finally block performs a yield again.
@Andrew question marks ought to be escaped in a url - they aren't really part of the path.
Currently we simply throw an exception (in the calling frame), but it turns out that's somewhat problematic
Post an example of what you're trying to match....and I'll be able to tell you how to handle that case properly.
12:34
@NikiC How so?
@MadaraUchiha Because any yield reachable from a finally block becomes a ticking time bomb, that may start throwing exception at some point
@Danack im just trying the example, if i have a url like articles/3/do-you-like-php-?, how do i catch in fast route ??
@Andrew the first question mark in a request marks the end of the path, and the start of the query params. Routes are based off the path, not off the query params usuaully.
@NikiC Under what circumstances would I want to put a yield in a finally{} block of a generator? My mental model tells me that regardless, the generator was already done by the time the finally block has been reached
@Danack ah i see, thanks :D
12:37
Or am I misunderstanding the problem?
@Andrew you want something like:
$url = sprintf(
    "articles/%d/%s"
    $article->id,
    urlencode($article->title)
);
@MadaraUchiha If you want to perform some async operation in a finally block
or write your own escaper that removes problematic characters.
@MadaraUchiha What we were considering is to treat those yields essentially as throwing statements. I.e. if we encounter a yield in a currently-destroying generator, we we'll go up to the next higher finally block.
@Danack thanks once agin :D, that works too. is it only the question mark or there are other illegal chars ??
12:42
Which avoid the exception, but also means that async operations are effectively lost
@Andrew there's lots of chars that should be escaped.
@NikiC async ops aren't lost, just their return value is…
which might be even worse e.g. in case of locks
@Danack will do my further reading :D, thanks for the fast reply :)
@bwoebi they aren't lost?
there's nobody listening on the other side ^^
@NikiC sure, but you don't do async ops via yield, you just wait for their result via yield
you dispatch them and dispatcher gives you a promise to wait on…
12:47
@bwoebi true
@bwoebi Why is that?
@NikiC if the lock won't get unlocked
though, you can have another finally then… but…
might be not that bad then… mhmhm…
back in half an hour…
Interesting
At least in JS, this is the behavior I'm observing from the de-facto Promise library that supports coroutines:
Promise.coroutine(function*() {
  try {
    yield Promise.delay(1000);
    console.log("lives");
    return "foo"
  } finally {
    yield Promise.delay(2000);
    console.log("died");
    return "bar"
  }
})().then(console.log);
Where Promise.coroutine() is a function that takes a generator function and has it yield Promises (similar to your solution)
The following gave me this output:
lives
died
bar
@NikiC yes we're working on that right now. I literally started a nodejs/promises group yesterday.
JS generators with return are quirky though
@BenjaminGruenbaum Yeah, very much so
What's quirky about them?
12:58
Promise.coroutine(function*() {
  try {
    yield Promise.delay(1000);
    throw new Error("foo");
    return "foo"
  } finally {
    yield Promise.delay(2000);
    console.log("died");
    return "bar"
  }
})().then(console.log);
This gave me "died\nbar", completely ignoring the error.
@MadaraUchiha That's ... ah ... normal :D
Finally always wins
@MadaraUchiha Those test cases, are they fully consumed generators or not?
How does cancellation work @NikiC :D?
Is there a way to set FPMs document root without relying on the webserver? Seems pretty insecure to me that the upstream http server can tell FPM where to look on the file system
If possible I'd like to get away with sending only REQUEST_METHOD and REQUEST_URI from http -> fastcgi
you can set chdir and chroot in fpm.ini
I still have to pass a SCRIPT_NAME though :x
yea sorry, I was brain farting, wasn't specific to document root, I want to specify the index file absolutely
13:09
that doesn't make sense. its like telling your webserver to only ever serve index.php regardless of the actual request
@Gordon which makes perfect sense for an API endpoint
@Leigh but that's more like a mod_rewrite then, isnt it?
@Gordon Imagine on api.gordon.guru you're running an nginx server, and you have a config a little like:
server {
    location /service1 {
        #...
        fastcgi_pass 10.0.0.10:9000;
    }
    location /service2 {
        #...
        fastcgi_pass 10.0.0.20:9000;
    }
}
yes, you cannot set that on fpm
I can hardcode the fastcgi_param to say the script_name is always index.php
13:17
yes. chrooting is your best option then
but I just don't like that
then add an option to the sapi ;)
such rfc, very lazy
can write it just for yourself. no rfc
I'd rather not hand over a solution where upgrading includes compiling a custom PHP
13:21
@BenjaminGruenbaum generator instance is dereferenced everywhere before fully consumed?
@BenjaminGruenbaum hm?
It's fine to say that it's not that important for a server most of the time
Unless you actually mean by GC
@BenjaminGruenbaum both
@zaq178miami I'm trying to figure out how to use the keepalive/heartbeats in php-amqplib with no luck .. $connection = new AMQPSSLConnection($host, $port, $user, $pass, "/", array('verify_peer' => false), "AMQPLAIN", null, "en_US", 3, 5, null, true, 30); .. am I doing it wrong ?!
13:26
If you want to link a table with two or more other tables (e.g. something like a notes or logger table), is it a legitimate practice to have something like type + id columns, or is there a better way?
@BenjaminGruenbaum at least we're discussing the issue because of someone encountering that behavior in real world code…
@Sean Why do you want to merge columns?
@PeeHaa Just a use-case. There's going to be a new part of our system which affects more than one type of entity (think users, user groups and permissions. Permissions can be set for groups, but overridden for specific users)
And where does the merging of columns come in?
I've seen it (and done it) before where you'd have a table with something like type ('user'|'usergroup') and an ID.
13:29
@bwoebi oh, you're actually discussing cancellation?
There's no actual merging.. I think o.o
@BenjaminGruenbaum not on promises … on generators in general
@Sean Do you mean an enum?
Think above the column type. I'm asking about the whole "type" and "id" as two seperate columns
for intents and purposes they're usually VARCHARs or something similar, well the "type" column is.
13:33
Without understanding the use case it is possible that it is not insane
@bwoebi generators in general do this with .return in javascript - in JS generators are both consumers and producers.
You can invoke a .return inside a generator which runs finally blocks
Alrght, let me stop trying to speak like an idiot and make it a bit easier to interpret ^^
@BenjaminGruenbaum The interesting question is what happens if you do not explicitly .return, but it is rather triggered by GC of an unreferenced generator
I vote "no automatic cleanup is performed" but "finally blocks are run and return is invoked" is also acceptable.
Coroutines and generators are not the same things, it's a special case.
I would expose a different method (not return)
@BenjaminGruenbaum bugs.php.net/bug.php?id=71604 look at that code and what would you expect? the generators are dtored at the yield…
13:38
One report was about a male attendee offering 2 separate female attendees a private sampling of relaxation techniques in his room. And when the women refused the man did not continue or push. When the incidences was brought to the man as being inappropriate he apologized and said he meant well, and he would not do it again.
Re-write, attempted to flirt slightly, failed, was reprimanded for it
@BenjaminGruenbaum Doesn't not performing cleanup violate finally semantics?
@NikiC the generator would never run - it's a little like:
function foo() {
    try {
        while(1); // this never ends
    } finally {
        echo "Yay";
    }
}
If the action never finished you can't always cleanup.
@Gordon I am really not sure that chrooting is a sensible thing to be doing....
@Leigh so basically, you have two different apps in separate dirs, and you want nginx to pipe requests to the appropriate app/dir ?
@NikiC @bwoebi is pinged there btw
So, sorry in advance, this is actually terrible. The use case is similar to what I'm looking to do
13:41
@Danack I have different services on different servers, running bare fpm, with no nginx in front of them
@BenjaminGruenbaum That's await though and not yield.
@Sean That's not bad
Using a couple of nginx only servers as an "api router"
Is that a legit setup? One column defined as the target type e.g. 'user' or 'usergroup', and the id pointing to the id of that particular table.
@bwoebi you don't have that yet :P
13:42
@Jimbo s/flirt/be a creepy fuck/ - offering a massage in a room as an opening gambit is just icky.
It just feels like there's a better way
Running code on GC is extremely risky.
@BenjaminGruenbaum right. but we're not talking about this…
I can use it to implement weak references and other funky things
@Leigh so what's converting http requests to CGI requests?
13:43
@Danack And here we get into the view of "creepy" being the perception of someone depending on their attractiveness level
57 secs ago, by Leigh
Using a couple of nginx only servers as an "api router"
Step 1, don't be ugly.
@BenjaminGruenbaum if you bring in await, you're missing the point of the discussion… can we please go back to yield and only yield?
@Leigh k. So what's the actual problem you're facing?
Is there a way to set FPMs document root without relying on the webserver?
FPM doesn't know where to look for the files?
@Danack I'm not facing one, I just think that the "default script" shouldn't depend on information supplied by the web server
I can hardcode where to find the script, but that is passed in the request to FPM
13:45
@BenjaminGruenbaum Given destructors, running code on GC is a foregone conclusion anyway ^^
:-)
@Leigh Default script is default......you can just use a better one.....and generating config files dynamically at deploy time is the correct thing to do for Nginx + PHP-FPM. cough oh hey, I have a library to do that
/laters, shops.
@Danack if i understand @Leigh correctly, he wants FPM to handle all incoming requests with the same script, regardless of what SCRIPT_NAME is.
@Leigh can't you fix that at the web server level?
sorry if you're repeating yourself.
@NikiC :(
@bwoebi yes, running coroutines to completion on GC is super risky - don't do it.
13:57
@FlorianMargaine Yea I can hardcode it
@BenjaminGruenbaum why risky?
@BenjaminGruenbaum so, no finally execution?
@bwoebi I get the merit of resource management, trust me. I just think users would not really expect finally blocks to automatically run. Especially if it's just a generator and not always a coroutine.
Finally not running is kind of unintuitive
@BenjaminGruenbaum not running finally blocks at all would be detrimental though … especially if you create a lock in try code and then the unlock is not run in finally…
Do you have a using or try-with-resource statement?
13:59
@BenjaminGruenbaum no
@bwoebi but you have not run the generator to completion.
What does C# do?
I don't know C#
What does python do?
I wonder what JavaScript does :D I have no idea
lol
It makes sense to not run finally blocks, it would certainly astonish me
14:04
well, try it out then, Benjamin?^^
The problem is that we have multiple implementations and async functions only work in one.
what does the spec say?
@BenjaminGruenbaum Python will throw a GeneratorExit into the generator
So it will run finally blocks
However the generator is required to rethrow the exception
@bwoebi The spec doesn't deal with garbage collection. JavaScript runs in some environments that have no GC at all.
@NikiC yeah, that's what I'd consider doing in PHP too…
14:06
As such it essentially does what PHP does as well
Namely, a yield triggered by force-closed finally will result in a parent frame exception
close() will also be called by Python's garbage collector when the generator is garbage-collected.
Interesting
Python agrees with you.
Python agrees with what we originally did. We're no longer sure we agree with ourselves :D
Part that starts at: "he addition of the close() method has one side effect that isn't obvious. close() is called when a generator is garbage-collected"
Here's the enhancement proposal python.org/dev/peps/pep-0342
I'm concerned about things like:
try {
   yield 1;
} finally {
   while(1);
}
14:09
Sounds weird to ask here, but are there Wordpress Formidable users here? :D
JS (in the await discussion I linked to) says it's the responsibility of the producer
Hi, need some simple PHP help with an issue anyone free?
@NikiC a yield, yes… but python actually throws a named exception in
You only do this because you hate me
sorry, wrong ping
@BenjaminGruenbaum not much different from __destruct() { while(1); } though.
does js have destructors?
@NikiC god no
14:11
lol
you're lucky
JavaScript is terrible at resource management, JS users are terrible at it. The only good thing is that they didn't add silly stuff to the language because of it.
@NikiC according to git blame it was Daniel adding that line ^^
I never use destructors in anything but C++. Well, I do, but only to log me being an idiot to the log and never to actually do anything but catch my mistakes.
@bwoebi I particularly love the combination of destructors and exceptions :)
@NikiC make them go to the global set_exception_handler immediately and if that fails, fatal out…
14:15
@bwoebi and erase all the files on the hard drive to make sure it never happens again
@NikiC hehe :-D
@NikiC no, that would be a bc break
@bwoebi I don't know who git blames, but I blame you for that :P
@NikiC haha :-P
Manager just brought up a hypothetical question to move away from our old unsupported framework..
.. to Laravel. Just sitting here like:
14:20
Oh wait, async functions avoid that problem completely.
It's only a problem with generators where you're the one running them
@Sean I've turned 4 different companies away from Laravel... join the cause!
@BenjaminGruenbaum How do async functions avoid it?
Hello! :)
Maybe someone could help me with my question? I found a code here in stackoverflow which displays a weekly calendar from Monday to Sunday. I only want it to display up to Saturday only though. Here's the link to my question :)
http://stackoverflow.com/questions/35426365/weekly-calendar-minus-sunday
@NikiC you never pause them, they always run to completion like synchronous functions
@BenjaminGruenbaum also in case the I/O event never happens?
14:24
@bwoebi yes, I was just thinking about awaiting something that pends forever.
is there something in the php engine that denotes a call to an external "thing", like filesystem oder database or http?
I assume the runtime would not guess the promise would never resolve and would never GC.
@BenjaminGruenbaum I mean like … the reference to the Deferred gets lost and then…?
@BenjaminGruenbaum yes
14:28
@Gordon Nope, if only we had a succinct streams API for such things :)
@Leigh yes, that's what I was hoping for
@NikiC generally I find that Python is too exception-oriented, but I guess in this specific case Python is doing it right and we should throw an Error too inside PHP... (and not just a fake)
@Gordon If everything supported stream wrappers you could search for something like php_stream_open_wrapper, but there's outliers that bypass it
All, can I ballpark an idea for a migration from a legacy framework to Symfony? Idea: Two different domains, all requests go through first framework, if not exist, go through with an API key for the currently logged in user to Symfony (via cURL) (which can automatically handle authentication via an API token) - so user is reconstructed in Symfony for the route that does exist there
Only addition: an API key table and join on the user in the legacy framework
@Jimbo What about, check if the route exists on the new framework first, so you can gradually override old routes with new
14:34
@Leigh I want to do that, in fact I have that working using stackphp (you stack middlewares and I converted original framework to use HttpFoundation (Request / Response) for this purpose. But the problem is authentication. Sign into first application needs to allow signing into Symfony too
whoever named these TSRMLS things TSRMLS deserves bad things
@Gordon stop looking at PHP 5 code
Thread-Safe Resource Manager Local Storage. Seems perfectly reasonable to me.
You're lucky it the name wasn't longer.
@jbafford when you know what it stands for
Thread Safe Resource Manager Local Storage Call with Comma
Thread Safe Resource Manager Local Storage Declaration with Comma
Thread Safe Resource Manager Local Storage Declaration
Thread Safe Resource Manager Local Storage Call
for the full list ...
14:36
@JoeWatkins thanks
all totally useless information now, none of those matter any more ...
I never got around to writing the actual talk, but I had a great title lined up: Journey to the Center of the TSRMLS.
Hi all, When I execute the a script using command line "php myFile.php" all go right.. When I try this on the server the server execute the script using cgi-fcgi. How can I force CLI?
@jbafford I think people don't really care about it ... there was one guy who I thought was interested ... but turned out he wasn't ...
it's kind of the whole point of the thing, the less you have to care about it the better it is doing it's job ...
@BenjaminGruenbaum github.com/tc39/ecmascript-asyncawait/issues/… well great…
We're not talking about timeouts, but about unreferenced promises …
14:41
posted on February 16, 2016 by nlecointre

/* by Strictfx */

pfft. users, who needs those?
pffft indeed
@jba
aargh. i meant: @jbafford : I use them for testing :)
@AndreaCatania You don't
boy, getting into php-c still feels like opening the gates of hell
14:46
You open the gates, and this giant malefic hand shoots out and pulls you through
the hand belongs too ...
@NikiC
@Gordon really, PHP is tame by comparison
@JoeWatkins it doesn't. I tried that already ;)
If you really want to see something worthy of Zalgo, look at the OpenSSL code.
@NikiC do you need commit access to remove these tiny … disturbances silently?
14:49
I actually have looked at the OpenSSL code, maybe that explains a few things about me
anything of a certain size or complexity is a mess, not a product of bad programmers really ... a product of C ...
I think OpenSSL has a lot of "do what the fuck I want" code, same as PHP
but don't say anything bad about C ... or I'll cut your face ... because I am a C programmer ... I have a deep and abiding knowledge of void pointers, and triple indirection ...
hehe
yes, but PHP didn't try to maintain a version that worked with Mac OS 9.
14:51
@Leigh openssl is an architectural mess too … PHP is by far not that bad…
triple indirection? Forget that. I am the master of arbitrary indirection
@jbafford No, we did maintain Netware support for a while though
hehe @ircmaxell
@ircmaxell pointers referencing themselves are nice? :-)
a pointer to a pointer to a pointer to a pointer, and so on and so on and so on
14:52
I love all that ... totally gets me off ...
uhhh
/me backs away slowly
@ircmaxell isn't that usually described as "attack" ?
Anyone know what the |= operator does? Can't seem to find any docs for it.
@JoeWatkins don't make us void cast you to R'lyeh
14:54
@Oldskool "bar equals operator" works great for me
@Oldskool bitwise-or assign
@Oldskool $foo |= $bar; is like $foo = $foo | $bar;
"pipe equals operator" also
the "|" character is known as "pipe"
it's more of a stick than a pipe
2
| |
that's a pipe ...
naming things is hard ...
it's a pipe
14:55
Ah right, thanks all :-)
I know yeah ...
because it's used to pipe output of one command into another a | b in unix
:-P
*/me tends to use a "silent hand motion", when using SSH-over-Intern protocol
if we all start calling it a stick, then it's a stick operator ... who's with me ?
@JoeWatkins It can only be a stick operator if we can beat people with it.
14:56
@bwoebi Nah
@jbafford allowed, obviously ...
@JoeWatkins I spent 2 hours implementing piping in my shell last night... no way am I s/pipe/stick/ everywhere now
"sticking" ?
LOL
yeah, that's not gonna work out well
$theMan |= $it;
14:58
@NikiC pfff^^
@NikiC so, what's your problem with something like GeneratorExitError?
in JavaScript - Spread Knowledge; Abolish Ignorance, 24 secs ago, by ndugger
Real programmers use jquery and RoR to serve static files through wordpress.
@Leigh you've got to think of it like this, s/hardcode/resolve at deploy time/. Generating a config file when the deployment happens, with the directory that the app is being installed into, is definitely the sane approach compared to either hard-coding in config files, or trying to do magic.gif to resolve it dynamically.
/in my oh so humble opinion
@FlorianMargaine Spread Ignorance, Abolish Knowledge?
@Leigh Demeter is coming back from his grave
15:02
@Danack It's just not that kind of environment, and to be honest, I'm not very happy with it.
It's a different kind of environment altogether?
@bwoebi C# acts like Python
cc @NikiC
@FlorianMargaine Demeter is an ancient goddess
the finally block is run.
I mean where I work... 99% of existing deployments are done with git pull...
15:03
@BenjaminGruenbaum Is it also done using an exception? What does it do with yield from finally?
fyi - this is how the root dir is found in my apps, and from that the fpm/nginx conf files are generated 'blog_root_directory' => dirname(DIR), - so there's no need for external deploy info. (for that bit at least).
Wait hmm blogs.msdn.com/b/dancre/archive/2008/03/14/… just found this @NikiC
The answer is no, it does not run finally blocks, I was just testing with a foreach constructs and generators are automatically disposable and run finally blocks @NikiC @bwoebi
@tereško her grave*
@bwoebi I think I need to see some example code where @kelunik is running into this
" Finally statements will not be executed during garbage collection as compiler generated iterator class have no finalizer "
15:08
@NikiC It was @Trowski
Ah, then @Trowski ^^
And I mean not the generator code, but the code that doesn't finish it
github.com/icicleio/http/blob/v0.3.x/src/Server/Internal/… … is yielding a Generator (writeResponse returns a Generator) which isn't being finished due to connection aborting and then when doing cleanup, the Generator never had been resolved and so this yield also never will be…
and then it gets cleaned up in cycle collector
The write response generator is partially executed?
It only appears in old versions of the docs 0_o
@BenjaminGruenbaum heh
15:13
@NikiC yeah
@BenjaminGruenbaum C# has a spec, right?
now the question how it behaves with catch and exceptions thrown inside finally …
That is so stupid. Have your damn star.
Wes
Wes
15:30
@Machavity best video of 2016 so far
imagine cleaning his house after he makes such videos
i would rather burn it and buy a new one
user924016
yay home!"
Wes
Wes
today basically i just stared at code and wrote nothing
same here
@Wes I just hit that point. I was about to use a trait and froze up.
Most of my days are like that :(
Wes
Wes
15:41
y u hate traits
y u use traits
y u hate using traits
y u not hate using traits
Wes
Wes
they have 1% use cases, but for that 1% they are great
15:44
y u y u?
user924016
U?
yii!
And thus, the Yii framework was born
We've just told a beautiful story guys
user924016
@Leigh lol
15:54
@PaulCrovella traits are really useful development tool - whenever you find a reason to use a trait, it is a clear indication, that you have fucked up something in your architecture
9
yeah, freezing up was some sort of empathic reaction - protecting my code from myself
@tereško this
@tereško no, I wouldn't say so. But is is an indicator for rechecking whether you did everything right.
OH: "traits are really useful - whenever you find a reason to use a trait it is a clear indication that you have #$^&ed up something"

« first day (1949 days earlier)      last day (3224 days later) »