« first day (3894 days earlier)      last day (1051 days later) » 
05:00 - 19:0019:00 - 23:00

5:06 AM
o/
 
How to get VLC video streaming work in a php script?
Also why my php script works differently as a webpage than on command line?
Like I am using php to call a shell script, shell script has an echo that gets printed on command line but not on the webpage.
 
the standard output of the shell you execute is different from the standard output of the web server
 
How do you mean?
 
 
1 hour later…
7:26 AM
Does anybody know whether ignoring auto_prepend and auto_append scripts are not implemented for the CLI server (php -S) ? Or is that an oversight?
 
 
1 hour later…
8:41 AM
@Derick My best guess would be oversight.
 
9:01 AM
Can't build opcache: 'zend_dfg.h' file not found ・ Compile Failure ・ #81136
 
@JoeWatkins Damn, you were like 30 seconds faster in pushing :P
 
haha
 
@Crell I'm happy to add some css for you but I'm not sure how to fix this
 
9:24 AM
Morning
 
9:35 AM
@Trowski @kooldev can you explain why you don't think blocking context switches is a good idea ? (it seems necessary to me)
 
@JoeWatkins Under which circumstances would that be a good idea?
 
9:51 AM
you can get some really strange side effects if you allow switches in destructors
<?php
$fiber = new Fiber(function () {
    $a = null;
    $b = null;

	call_user_func(function () use(&$a, &$b) {
		$a = new class () {};

		$b = new class () {
			public function __destruct() {
				Fiber::suspend();
			}
		};

		$a->next = $b;
		$b->next = $a;
	});
});

$fiber->start();
?>
Cannot suspend outside of a fiber
the code is odd, but it doesn't make the result expected, how do you avoid this if you don't block switches ?
 
@JoeWatkins Destructors in shutdown sequence ... But at that point you have to take care that a target to jump to exists - a library will do that for you
 
okay, so you want it to be the libraries problem, presumably they're retaining a reference somehow ...
 
@JoeWatkins We'll pretty much have to allow them in destructors, otherwise you can't close files etc. on GC.
 
isn't this supposed to scale to the order of hundreds of thousands of objects ?
 
@JoeWatkins The abstraction will take care of that.
 
10:03 AM
@JoeWatkins yes. I do not recommend using Fibers manually inside destructors. But a library will be aware of that.
 
it still looks like it needs blocking to me ... not refusal, necessarily, but delay until safe ... is that not possible ?
you consider it the libraries or abstractions problem, but it looks like ours to me ... maybe it's right on the line, and the line is a bit fuzzy ... what do we say to people who write code that does surprising things ? use amp or some other project ?
I guess it wouldn't help
I don't like it
you're always going to be able to write really surprising code, and saying use some other project, doesn't really seem like a solution, but admittance that the thing isn't complete/finished ... which we done on purpose, and I get that, and I get why ... I just don't like this ...
 
Morning all
 
@JoeWatkins it's not that hard to fix, you basically just need a trivial wrapper function "if no Fiber::this() then do blocking action else suspend"
which is a quite trivial function not needing a whole library
but yeah, with fibers potentially running in destructors, you need some no-fiber fallback handling
the "cannot suspend outside of a fiber" error basically means, "hey, you forgot to handle the no-fiber scenario"
 
10:21 AM
yeah, I know, but it's surprising that the code is written clearly in a fiber, and you get that message ...
 
@JoeWatkins the stacktrace is pretty clear though, to debug that.
The problem really is that fiber switches in destructors are far too useful to disallow them
 
Stack trace:
#0 /opt/src/php-src/test.php(11): Fiber::suspend()
#1 [internal function]: class@anonymous->__destruct()
#2 {main}
  thrown in /opt/src/php-src/test.php on line 11
is it ?
 
@JoeWatkins yeah, you clearly see it's destructed on top level…
tbh, I don't expect people-with-no-idea-what-they-are-doing to jump on fibers
 
@bwoebi I suppose, I don't think I'd call it clear ... maybe "pretty clear" :D
@bwoebi well they wouldn't have to have written the code themselves ...
 
People with no idea what they're doing jumping into things is kinda PHP's thing :P
 
10:29 AM
I was sort of under the impression, that while this is aimed at libraries, you could use it if you wanted ... but now it doesn't really look like that's true, and everyone else seems okay with it, like that's what they expected ... they expected to add an as yet non existent and external dependency to fiber class ...
 
@MarkR This describes every day for me.
 
Incident with Issues and Pull Requests ・ Notifications has Partial Outage ・ Gists has Partial Outage
 
It would seem to me that if an engine feature effectively demands a third party userland library to be minimally usable, then said library belongs in php-src.
 
I have a hard time reconciling reality with the things I keep hearing, like fibers are transparent ...
 
Incident with Issues, GitHub Packages, and Pull Requests ・ Notifications has Partial Outage ・ Gists has Partial Outage
 
10:54 AM
All issues have been resolved!
 
cmb
ta
 
Hey guys
 
@JoeWatkins … they are transparent outside of shutdown sequence and cycle collector :-)
 
11:12 AM
So, the Enums RFC mentions having a read-only property $name.. but the implementation currently as it shows on 3v4l shows that the property is now called $case... is there documentation about the intended actual behaviour yet? (example, copied right from the RFC: 3v4l.org/4CvNV/rfc#focus=rfc.enumerations)
 
11:22 AM
@JoeWatkins There will always be an abstraction. If we don't want that, we can't ship fibers in the way they are.
 
@Stephen The RFC branch in 3v4l is out dated, you can see that it behaves correctly on master: 3v4l.org/ZKZj2/rfc#git.master
 
@SaifEddinGmati oh nice, I didn't even try master.
 
11:37 AM
Build failure on OS X 10.11 and earlier due to use of clock_gettime_nsec_np ・ Compile Failure ・ #81137
 
@Sjon The quickiest would probably be to have enough dead space padding at the bottom of the page that the content scrolls up past the height of the hover checkboxes.
 
11:59 AM
is it normal for mac users to have an os that's 5 years out of date ?
 
Absolutely
lol
 
@JoeWatkins why do you attack me like this?
 
@JoeWatkins well … apple tends to not support models older like 7 years with new OS releases… so …
 
actually, mine might be up-to-date as of a few weeks ago.
 
So you can buy moar!
:P
 
12:04 PM
when you have a 12 year old machine it may well be that they're just stuck on pre-Sierra
 
@bwoebi quick glance here please, it was too early to merge this, right ?
 
@JoeWatkins yeah, should really be #if'ed against the OS version
 
if the old api is stable, and the new one is specifically marked np, I prefer the stable api ...
 
@JoeWatkins developer.apple.com/documentation/kernel/… - well, docs do recommend the new API …
 
well that's confusing
 
12:09 PM
@JoeWatkins non portable only means that it isn't available on BSDs
(but apple specific)
@JoeWatkins but anyway, the libc code shows that this function internally uses the mach call (opensource.apple.com/source/Libc/Libc-1158.1.2/gen/…)
 
@Danack I need to see if the latest version supports Ableton, Mainstage 3, and Logic and I can update mine. I'm always afraid to update my Mac.
 
@bwoebi I just got to there, but that's if you use UPTIME_RAW, monotonic uses continuous time, not sure what the difference is
the doc says UPTIME_RAW is equivalent though not monotonic raw, so I don't see the point in making the change at all ...
 
Me neither except "more modern API for little reason"
I'd revert it with a comment
 
12:26 PM
Good morning o/
@JoeWatkins I prefer to block fiber context switching in destructors / GC because it is impossible to tell when that code is going to run and which fiber it will suspend. IMO this leads to unpredictable behavior and should be avoided. Calling Fiber::suspend() directly within a destructor is unlikely to happen, but it might happen in some method that is called from the destructor and you never know if it will happen unless you have complete control over all of the code that gets executed.
 
this is more or less what I think, apparently I'm wrong and it's really useful to be able to switch in dtors
at least bob and niklas thing this is the problem of the framework or abstraction you use ...
 
If you ever find yourself in a situation where you need to do something that involves fiber switching in a destructor it will invole a scheduler (aka event loop) and the better way to do it is to call something like $loop->runLater(fn () => ...). AFAIK this what Amp does due to promises / generators and I very much prefer this.
 
dtors are only a little bit of the problem anyway, they are a special case of a wider problem, which I tried to bring up a couple of weeks ago but made a mess of it ... we can't think of any examples, but any extension code that executes a callback in what it expects is a critical section will break if a switch happens and that section is re-entered by whatever fiber was switched too ...
 
Yes, destructors / GC is just one example where a context switch might bite us (depending on personal preference). But there are certainly other functions that must not be interrupted by a fiber context switch, hence introducing and additional EG to control this is not such a bad idea.
 
I think there ought to be a mechanism to prevent this, but I don't know what it looks like, you can't just block the switch from happening, I think you have to delay it until it's reasonable (like runLater looks like it does) ...
 
12:38 PM
@MatthewBrown so, presumably you watched the video?
 
Another thing to watch out for is that fiber context switches are not restricted to calls into Fiber from userland. With the internal API every C function call might also switch fibers.
Delaying the switch would require some kind of scheduler to be involved and PHP fibers do not provide a scheduler...
 
which is why bob and niklas are saying it's down to the abstraction to solve this problem ... but how I use that abstraction from an extension, I don't know ...
 
A scheduler sounds reasonable
 
In the case of PHP fibers in userland the caller of Fiber::suspend() IS the scheduler, hence throwing an error from suspend() makes sense to me.
 
Provide a base implementation and then offer the chance that said scheduler can be changed in userland
 
12:44 PM
@ln-s I How do you imagine such a scheduler should work? I am having a hard time to come up with something that does not change the PHP Fiber API...
 
I would check what swoole has regarding this aspect
I'm not a core dev, I just wanted to say that what you said it just makes sense
 
The thing about Swoole is that they are running a reactor (event loop) that is their scheduler and will switch fibers as needed. This is certainly possible but is way beyond what the Fibers RFC was about.
We need a solution that works with what we got right now. I prefer the "throw an error when suspend() is called" solution. It is not ideal but at least consistent...
 
Fiber::suspends(function(Fiber $fiber) use($reactor) {

});
 
IMO not much different then $loop->runLater(fn () => ...) unless $reactor is something provided by PHP core...
To further complicate things PHP fibers require explicit scheduling from the outside using start() / resume() / throw(). How would such an API provide that?
 
except you don't need the implementation of loop, or reactor ... Fiber::suspend will forward to your "scheduler", which can tell if there's anything to switch too, or whether to delay the thing (if you have a loop/reactor), calls to Fiber::suspend from the scheduler function will behave as normal (invoke the actual Fiber::suspend implementation)
I don't like it anymore anyway, your turn to idea
 
1:00 PM
@kooldev That's exactly why I wouldn't forbid it. It makes calling any code unsafe in destructors.
 
To be clear: If we go anywhere near providing something like a scheduler right now it will dramatically complicate a move towards async / await in a future version of PHP...
 
(Is async/await even desireable? It's the worst part of Javascript.)
 
@JoeWatkins Anything that accepts a callback already needs to be prepared for that.
 
@Crell There is no need to use async like in JavaScript, with fibers it would be more like the "go" keyword in Go.
 
@kooldev And then spin up another iteration to add said scheduler ?
 
1:03 PM
That's more like it, then.
 
@ln-s It would not be unreasonable to come up with such an RFC for a future version of PHP if fibers work out fine.
 
@JoeWatkins Extensions need to expose a file descriptor to poll or accept a specific object directly, like a userland scheduler.
@kooldev No, the caller of Fiber::suspend is never the scheduler.
 
@kelunik Yes you are right, the caller of start() / resume() / throw() is the scheduler. But if suspend() fails that error will likely bubble up into the scheduler.
 
Still kind of wonder why was the decision to go with fibers when swoole had all of this thought out, I know fibers are less opinionated than swoole, but I still think that the opinionated part could have been refactored / removed from it
 
@kooldev If we'd built a scheduler in, we'd also build async / await right now.
 
1:07 PM
you must not be reading my blog ... I forgive you @ln-s
 
(not the way JS built it)
 
@JoeWatkins I wasn't, I will now
 
@kelunik can you explain that, suspend seems to be "the co-operative bit" ... looks like scheduler ?
 
Swoole is being treated with mistrust, possibly because it's Chinese.
hahaha yeah ...
 
@JoeWatkins If you suspend in the scheduler, you'll halt the scheduler. ;-)
 
1:08 PM
@ln-s I think I meant to say this the other day. The recurse people have a pretty good rule - No backseat driving. Just throwing out suggestions and questions when you're not up to speed on something is a lot less help than you might think.
3
 
@ln-s No it isn't
 
@Danack And who in the world would possibly explain this to me better than a core dev ?
Thanks for the article @JoeWatkins
 
@kelunik I know that, I have been there with ext-async. :-)
 
@Danack Would be cool and more constructive to point out how to get "up to speed" instead of just throwing out a negative comment
 
@ln-s 4 people in this conversation are up to speed, and having a productive conversation. People have limited time + energy. No one owes it to you to give you all the information you need to take part.
 
1:16 PM
Ahhh I see
 
(for the record I don't understand it, which is why I'm not taking part)
 
Well Joe provided a link
 
@Danack Isn't giving people the information they need the point of RFCs? :P
 
I think we definitely need a way to block fiber switches in some areas. If one of these areas should be destructors / GC is not for me to decide. I can live with dtor / GC not being blocked, you just have to be very careful in these areas.
 
Jesus
 
1:25 PM
@kooldev have you looked at any other languages for reference, is there anything somewhat comparable ?
 
@JoeWatkins I am not aware of the way Ruby or Lua deal with that (they use a comparable fiber implementation). It seems that at least Lua decided to forbid fiber switching in destructors (tarantool.io/en/doc/latest/book/admin/troubleshoot/…) but I am not an expert...
The most prominent language using fibers is Go and it does not have to deal with that problem at all because they do not have destructors (and work around that using defer).
 
@kooldev I'm really torn there. On the one hand I think we should ship with a scheduler right away, on the other hand, fibers alone allow userland to find out which scheduler API etc. makes the most sense and allow for slower adoption and people getting used to them over time.
 
@kooldev I think it's important to have the GC re-entrant at least though
 
@kooldev defer is a replacement for finally, not destructors, no?
 
@kelunik Correct, it is basically the equivalent of wrapping the remaining code within a function in try / finally and execute the deferred statement in the finally block. Probably the best way to work around lack of destructors for them.
With the upside that they do not need to worry about fiber switches in destructors. ;-)
@bwoebi I had a look at what the GC does... it scared me enough to put it aside and do something else...
 
1:40 PM
@bwoebi I wanted to say: Just make the GC a fiber, but you can't allow suspend there then either. :D
 
@kelunik haha
 
so the argument against forbidding it, is that it would disallow useful things in destructors that libraries want to do, but the examples there show it wouldn't, you just have to do it differently ...
why won't that work for us ?
it looks reasonable to me
 
@JoeWatkins Well @kelunik has a valid point against it: You have to assume that any function / method you call from a destructor might throw a "suspend not allowed" error.
And we are not just talking about direct calls but also nested calls that might happen somewhere deeper down the call stack.
 
@JoeWatkins Libraries can work around it, but adding a suspend anywhere might strictly speaking be a BC break then, because it might be called from a destructor somewhere.
 
1:59 PM
I've spent far too long frowning at my screen today
 
I have an xpath query:
$xml = @new SimpleXMLElement($package_xml);
$result = $xml->xpath("/package/stability/release");
That works when the root node is <package> and fails when it is:
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.4.7" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 pear.php.net/dtd/tasks-1.0.xsd pear.php.net/dtd/package-2.0 pear.php.net/dtd/package-2.0.xsd">;
is there simple way to change the xpath query to work with the verbose root node?
 
@Crell @JoeWatkins You ready?
 
@Danack Use $xml->registerXPathNamespace('p', 'http://pear.php.net/dtd/package-2.0') and $xml->xpath("/p:package/p:stability/p:release"); ?
 
@Derick yes, maybe
 
:-)
OK. Larry and I are ready for you.
 
2:11 PM
@Danack latest phpstorm version can form an xpath query for you, if you open the XML file in phpstorm
 
@Derick reboot, one sec
 
@Danack click wherever you want the xpath to be generated, open right-click menu, Show Unique XPath
(I can't remember what the "right-click" menu is called on Mac, and I'm not familiar enough with OS X)
 
@kooldev thanks...but didn't seem to work....
@Tiffany it's a file I control....I just str_replaced the bit that confused the xpath.....
 
Morning
 
@Danack did you add "http://" in front of pear.php.net? That got turned into a link by chat... And maybe "stability" and "release" could be in a different namespace...
Morning o/
 
2:24 PM
@kooldev I mostly agree. Generally a destructor shouldn't suspend and use a defer, so restricting makes sense, but @kelunik does make a good point. A built-in scheduler doesn't solve the problem either, unless all destructors are run in a defer.
In the future if we have async/await, would await be forbidden in a destructor then as well?
 
@kooldev thanks...no. tbh I'm just going to hack it. it's just a sanity check for the package.xml in imagick.....rather than something that needs to work with generic xml files.
 
@Trowski That is a good question and I am afraid I do not have a good answer... :/
 
Neither do I… mostly suspending in a destructor isn't a problem unless the fiber never resumes, but is that our problem or the coder's problem?
(I have no idea what the answer is to that question either)
 
It is a problem that you can work around to some degree if you know what you are doing and you know exactly what all the functions you call are doing.
 
A destructor shouldn't usually be doing I/O anyway. We have some use-cases for it in low-level libs (the file library comes to mind), but we have to do that in a defer now and will probably continue to do so.
 
2:36 PM
I am not super-happy with blocking switches and throwing but I do think that it is a more consistent and reliable way to deal with fiber switches than to just let them happen for now. Maybe that restriction could go away in future versions if we discover a way to handle it in a better way.
 
I'm mostly OK with that because you'll quickly find out if it throws, and can wrap the code in a defer then if needed.
Restricting a future await from destructors seems reasonable too.
 
2:57 PM
so we seem to agree that we should do this
 
I'm comfortable adding a restriction because we can always remove it.
Plus if an extension wants to guarantee no suspension in a callback, there would then be a mechanism to do so.
 
can we think of a better, more forward compatible implementation than a flag in eg ?
 
Howdy! I have a quick question, is there a way to disable a foreach loop for testing besides just commenting it all out? Similar to how for While and If statements you can just add "AND 0" at the end to make sure it doesn't run
 
I'm thinking that some extension might want to alter this behaviour, and I don't see a way to do that if we're setting a flag ...
 
@SlamJammington Write if (0) before it?
 
3:07 PM
perhaps we have zend_fiber_block() and zend_fiber_unblock() that the internal implementation sets with default implementation, but an extension may override if they don't need/want it to behave this way ?
 
@NikiC Oh that's smart, not sure why I didn't think of that
 
@JoeWatkins Default implementation would still use an EG, no?
But the EG would not be the recommended way of controlling it.
 
could, or __thread in zend_fibers.c ... in general I'm not sure why a lot of this stuff is even in EG, doesn't seem to be used from executor ... I would have moved it all into __thread in zend_fibers.c ..
 
Definitely could, certainly not too late yet :)
Mostly just seemed EG was the way of doing thready things.
Thinking about it though, the existing fiber-related EGs are used elsewhere.
But this could use __thread.
 
I like hiding things, the more we expose, the less we can change ...
I think one is used for INI
 
3:17 PM
@JoeWatkins ofc
 
If you move these things out of EG you need to provide a set of accessors to get them as they need to be checked to access the running fiber context.
 
@kooldev Right, we'd have to add zend_fiber_get_main_context and similar for others.
 
That would be quite a few additional function calls and (I think) they cannot be inlined by the compiler... not sure if this is a good idea.
Different story with block() / unblock(), they will probably be better suited for hiding internal state.
 
since we don't know what the implementation details are going to be ... tomorrow ... I think it's best we hide them, it does mean function calls, and if that proves to be a problem, when we have stable detail we are willing to expose we can solve that problem ...
 
It would be nice to know an extension couldn't alter EG(main_fiber_context) and EG(current_fiber_context).
That being said, an extension is pretty free to break the engine anyway, so does adding such a protection really matter?
 
cmb
3:26 PM
^ that
 
they're free to break is precisely because they can access it's state ... this state is too dangerous to fuck with imo
 
I do like the idea of hiding the details of block/unblock.
 
any interaction between a third party and fibers needs to be via a well thought out api ...
 
Come up with only one more API though... I don't like Xdebug breaking every day due to the changes ;-)
 
@Derick lol, sorry about that.
I was going to PR the last change but @kooldev beat me too it, so I fixed some warnings for you instead.
 
3:32 PM
I beat nikita in a commit race this morning ... it was the best morning ...
 
Third party cannot do much with fibers (fiber context) because they do not have access to jump_fcontext(). The only way to perform a fiber switch is by calling zend_fiber_switch_context(). It is of course possible to change EG(current_fiber_context) from within an extension, but that is true for basically anything in EG...
Plus we are handing out zend_fiber_context to observers (like XDebug) that could mess with it and break it if they really wanted to. ;-)
 
I'm not changing anything with fibers, I just need to know when a switch occurs
 
observer is a well thought out api, so ...
 
Just saying that if someone really wants to break fibers there are easy ways to do so.
 
memset(executor_globals, 0, 4096) would also do...
 
3:38 PM
@kooldev it's harder to break them if you can't access any details, it's harder to misuse them, but it's easier to change those details even when the abi is frozen ...
we're at the point where the benefits of hiding them far outweigh the advantages of exposing them, imo
 
I don't see how exposing the current fiber and main fiber is any worse than most of the things in EG
e.g., Changing EG(vm_stack) is not going to go well either.
 
it's not, but those things are already exposed ...if it were reasonable, I'd say there should be api for that, but it's not reasonable, and those details have evolved pretty steadily, they are mostly stable ... except for the 5 things you added in the last few weeks ...
 
@JoeWatkins Understood. But would you also want to hide all the details (struct fields) from zend_fiber / zend_fiber_context? This would require yet another refactoring and a different approach to fiber context (right now it is embedded to avoid memory allocation)... and of course require a change in obersers again. :P
 
if you think you can get to abi freeze, and then make no changes for a year, go for it ... I think you can't do that ...
 
Nikita and Dmitry made a number EG changes in the last few months.
@kooldev I wondered if zend_fiber needed to be part of the ABI
And also wondered if zend_fiber_context should be embedded or a member.
 
3:47 PM
@kooldev I mean we're talking about 20 minutes work, to make the next year easier ...
 
@Trowski You could change that in the same ways as zend_fiber_stack. Just expose the type but not the struct definition.
 
@kooldev Well we need zend_fiber_context exposed.
But maybe not zend_fiber.
 
@Trowski yeah, but mostly stable ... and they were probably changes they were waiting to make ...
 
Hi guys I am here have a doubt on apache automatically opens multiple ports while trying to download images from s3 bucket. Is this normal?
 
It is also possible to hide away the internals of zend_fiber_context but that is a little more involved. We would need to store a pointer in fiber_context that refers to zend_fiber (or some other implementation) to be able to lookup the correct fiber object. This is doable at the cost of another memory allocation and following one more pointer.
Finally it would require a new struct that is exposed to observers and exposes a limited amount of information...
If we did all of that no internal state is accessible outside of zend_fibers.c
 
3:55 PM
@kooldev I was thinking that the stack pointer could also contain the handle and function, and zend_fiber_context then would be just a kind pointer, undefined stack pointer, a status, and flags.
 
@astrosixer outgoing ports? yes.
 
I don't think zend_fiber_from_context is actually used anymore, so maybe the reverse pointer isn't needed?
 
(i think).
 
@Trowski That would be really bad for extensions. If you write your own fiber implementation (async task, future, ...) all you have is access to EG(current_fiber_context) (could also use an accessor function if hidden). And you need to be able to find your struct using only the context.
 
@Danack yes
 
4:00 PM
Right now this is easy (thanks to struct embedding), but it would require a different way if fiber context would be allocated separately.
 
@kooldev kind could be used for this technically.
 
whatever ports are shown by xampp isn't output ports right?
 
Yes, if it was allocated separately.
I was thinking of making context a struct member (which isn't terribly different from embedding)
 
The problem with kind is that you need that value to be the same for all your fibers (it is like a static property) to identify them.
 
@astrosixer I don't know what you're looking at, so can't comment on that, but each TCP/IP conncetion needs to be unique per connection from a combination of source IP address, dest IP address, source socket and dest socket. I think this answer covers it in more detail: stackoverflow.com/a/152863/778719
 
4:03 PM
@cmb Another gift for you: github.com/php/doc-en/pull/689
 
@Trowski You can of course use field of type zend_fiber_context, this would allow us to drop ugly macro defining the fields. +1 from me on that.
 
cmb
@Crell sorry, I'm not allowed to accept gifts :p
 
/me slips @cmb a $20 instead.
 
@kooldev At the cost of a few places such as fiber->status becoming fiber->context.status, but that's just syntax, no real difference.
 
@Trowski And it will not even break the observer API. ;-)
 
4:11 PM
@JoeWatkins @kooldev This doesn't use it anywhere yet, but something like this? github.com/trowski/php-src/commit/…
Needs a guard on the decrement, mostly wondering if that was the direction you were thinking.
 
Thanks to folks who have added friendly emoji reactions to https://github.com/php/php-src/pull/7091 !

Is there anything else I need to do before it's ready for review?
 
> Thanks to folks who have added friendly emoji reactions
I have strong feelings about the utility of those as a communications method.
 
Inquiry. function foo(string $a = null) hasn't been deprecated yet, right? (Default null despite not typed nullable.) I know there's been talk of it but has anything been done on that front?
 
@Crell no, but fyi there is a hoop to jump through for extensions to make it work in 8.1 compared to 8.0.
 
What sort of hoop? (Context: I'm trying to justify adding a ? to a string type def that has a default of null right now, on the grounds that it's Just Wrong(tm) to default to null on a non-nullable type.)
 
4:21 PM
@BenMorss just checking have you run that code through valgrind just in-case? and also compiled with stricter CFLAGs? Very slightly weird seeing php_gd_image_reader reader;not being initialised apparently.
@Crell just internal stuff
 
@Trowski I am assuming this is flexible enough but there is one thing that will not work as you probably expect: If a PHP Fiber object is destroyed while still suspended you need to switch into the fiber (even if switching is blocked) to throw a graceful exit. I fell into that trap myself and needed to (temporarily) unblock fiber switching within zend_fiber_object_destroy().
 
morns
 
And yes, function foo(string $a = null) is probably an implicit version of function foo(?string $a = null) - though imo it's a small inconsistency, that would break a huge amount of code to clean up.
It could be one of those things that needs to be phased in changed slowly.
 
@kooldev This doesn't prevent the internal API from switching, only user land calls.
If we want that, then yes, I'd have to ignore it in the destruct case.
 
well, the only way would be to add deprecation warning and drop support in next major.

as for "huge amount of code to clean up", that's not really a problem tools like php-cs-fixer can add a rule for it ( i think there's one actually, not sure ) and you can fix your code base within seconds
as for extensions, that's not my area of expertise
 
4:26 PM
@kooldev I'm not sure if preventing switching from an extension is desirable.
 
@Trowski Ah OK, I did not see that you are not checking in zend_fiber_switch_context(). This will certainly work for userland code and that would be sufficient for PHP 8.1
 
It's not just in any one application, it's in every library across the ecosystem. Having annoying breaks makes it harder for people to upgrade.
 
@Danack thanks for the comment! I don't see a case where uninitialized values could be read, but if it strikes you as unfortunate, I could initialize every member of the struct explicitly.
 
@kooldev I mean… I could attempt stop an extension switching in zend_fiber_context_switch, but if we are going to allow them to override the functions that do the blocking, then… is there a point?
It would just be a longer path to the same destination.
 
4:30 PM
Making it so that people can opt-in to it, and have most of the ecosytem already migrated, before actually breaking anything would make upgrading across versions be easier (probably). The experience with PHPUnit and how different versions of it, can't run on different versions of PHP have been a painful experience for many people.
 
@Danack deprecation is not a BC break, and i know, every library can fix it like any other syntax deprecation before it
 
Ocramius would disagree with you.....and even if he's wrong on that bit, making upgrading easier for a low value consistency cleanup like this makes it more likely to be worth doing.
 
@Trowski Yeah, extension are quite powerful, no point in holding them back. The only thing that bothers me (at least a bit) about it is that it involves 2 function calls whenever we need to block fiber switching. Of course function calls are pretty fast in C but if we want to use this around destructor calls it might add up. Let's hope not too many people make heavy use of destructors.
 
@BenMorss It's less of a surpise factor just initialising it. And makes it less likely to break when someone changes some code later. For the record, I have spent probably close to 200 hours over the past 4 years, investigating unitialised memory problems in ImageMagick. So I might be 'biased' by that to err on the side of safety.
 
@Danack adding ? before the type is definitely than using packages
 
4:37 PM
@BenMorss have you looked at other implementations for reading the header, particularly around sanity checking the header_size ?
 
@kooldev That's a good point, it's adding a little overhead around every destructor call. No idea if that matters though.
@JoeWatkins ^^ ??
 
I feel left out.
 
Wonder what's going on there?
 
json_encode doesn't mention dtring could be returned ・ Documentation problem ・ #81138
 
4:49 PM
users.jpg
 
@CraigFrancis strawpoll.com/en
 
@Danack Some sanity checking already exists there. And, indeed, I did consider a few different ways to check the header! I will take your advice and initialize that struct. It will indeed help future-proof the implementation
 
5:10 PM
@Trowski gimme a half hour or something ...
 
@JoeWatkins I'll merge in what @kooldev in his PR and let you look at is a whole then.
 
5:22 PM
Hello
Anyone
 
Hello. I am Galstaff, sorceror of LIGHT!
 
I have a basic question in php oop
<?php
   class Profile {
      private $language;
      public function setLanguage($language){
         $this->language = $language;
      }
   }
   $profile = new Profile();
   $language = array["Hindi","English","French"];
   $profile->setLanguage($language);
?>
In this class what about this statement $this->language = $language;
$this->language = $language;
the word language never used!
 
And your question is?
 
about the language word why is it exist?
 
Why are you asking us, instead of the person who wrote that code? Are you accusing one of us of writing that code?
 
5:29 PM
I find like this a lot
 
@Danack J'Accuse?!
 
@PHPFan it looks like a value object... it stores the information in state, and maybe somewhere else within the code it's accessed... assuming there's a getLanguage() method
 
3 mins ago, by Danack
Why are you asking us, instead of the person who wrote that code? Are you accusing one of us of writing that code?
you're suffering from the Streetlight effect. Either ask whoever wrote that, or just assume it's crap code, probably.
 
bothers me that it passes an array filled with the properties though
 
5:32 PM
@Tiffany So information variable is created and will accessed somewhere else ?
 
HOW could she know?
 
@PHPFan it can... it depends on the rest of the code base, but based on what you pasted, it looks like a value object
 
@Trowski okay cool, I might be afk when you ping, but I'll be back ...
 
@JoeWatkins Almost done actually. No rush though.
 
$language here is a value
$this->language = $language;
and language is created object true?
 
5:36 PM
@PHPFan I don't understand what you mean with this question.
$this->language is a property of a class, Profile
$language is an argument which is passed to the setLanguage() method, then assigned to class's $language property.
slightly confusing, sure, but it's a by-value assignment and works
 
Okay it's a property created by the mentioned statement true?
brb
 
@JoeWatkins github.com/trowski/php-src/commit/… with changes based on @kooldev's #7134
 
@PHPFan mentioned statement? what do you mean? private $language; is what defines the class's property, but it isn't assigned a value yet. $this->language = $language; is what gives the assignment.
I must get back to work, lunch over.
 
@kooldev I had to delete this test in my version, but you didn't in yours. I think that was a result of allowing fiber switching during destruction of a Fiber (finally blocks have so many edge cases).
 
oh, INI_INT is not converting K, M, G into multiples? confusing :D
 
5:51 PM
Pushed a similar, simplified test.
 
Okay, embarrassing question - what's the command for packaging a pecl package to make it ready for release?
 
That's a good question
 
apt install php-pear
of course.... then pear package
 
Ah yes obviously
 
@Trowski don't really love symbol names you chose, zend_fiber \t should show me related fiber symbols, zend_fiber_context \t should show context related, zend_fibers_switch \t same, and so on ... and I don't love prefix zend_fiber for something that will effect all fibers ...
I wonder if eg shouldn't have a counter for constructed (but not yet destructed) fibers, that could potentially start (or have been started), then those calls could be guarded and avoided if not actually using fibers
if (UNEXPECTED(potentially_fibers_could_ruin_us)) {
    zend_fibers_switch_block();
}
would be nicer I reckon ...
what do you two think ? /cc @kooldev
I don't really want to bundle any more stuff into eg, am still hoping you'll evict some things ... I really think it's going to be hard on you after abi is frozen .... you don't want to wait a year to make changes, you don't want to compromise on design because of ABI
 
6:22 PM
@JoeWatkins zend_object_std_dtor should be in dtor_obj, not free_obj?
 
ignore me, I got mixed up
 
I must have followed one of those flawed extensions :P
Ah, ok
 
that does happen, std_dtor in free_obj, but I was thinking std_dtor is the one that does destroy_object, but that's destroy_object
naming things
 
Heh, right…
 
@JoeWatkins What naming scheme would you suggest instead of prefixing everything with zend_fiber?
 
6:27 PM
wait, a free_obj could invoke a dtor of property couldn't it ?
 
I think he meant that it should be zend_fiber_switch_*, not zend_fiber_*_switch
 
what effect may that have ?
 
If the property is an object it will already be guarded by the changes in objects API, no?
 
Yeah, should be.
I think we're double guarding on free_obj.
 
yeah
 
6:30 PM
Yeah, I think free_obj will not be a problem at all unless some extension executes PHP code within that handler. I don't think we should account for that.
 
agree
 
6:43 PM
hi
 
6:56 PM
@JoeWatkins github.com/php/php-src/compare/master...trowski:fiber-block Do you think we need the block/unblock functions to be re-definable?
Never mind, yes, probably so an extension could block switching in it's own fibers.
 
@cmb For the is_callable doc patch, where exactly in the description should the new text go? It seems odd to put it before the parameter list.
 
> Upload New Release ERROR: You can not delete your own maintainer role or you will not be able to complete the update process. Set your name in package.xml or let the new lead developer upload the new release
 
@Trowski As you are changing things up could you do me a favor and change test invocable-class.phpt to use --EXPECTF-- and object(Test)#%d (0) { }? I do some testing with an extension that create an object in RINIT and that changes the number in that test to object(Test)#3 causing it to fail all the time.
 
	<lead>
		<name>Dan Ackroyd</name>
		<user>danack</user>
		<email>danack@php.net</email>
		<active>yes</active>
	</lead>
anyone have a clue what it is checking for? I guess I can look in the pecl website code to see exactly what checks it is doing...
 
05:00 - 19:0019:00 - 23:00

« first day (3894 days earlier)      last day (1051 days later) »