« first day (3781 days earlier)      last day (1164 days later) » 

DGF
12:20 AM
Hey. Does anyone know how to change the default text editor ? I want to add NVim as my default text editor but I'm having an hard time making that happen
Tried adding export EDITOR="nvim" to .zshrc but that didn't work
Right-Click on a file and change the default Text Editor won't work, since NVim doesn't appear as option...
 
 
1 hour later…
1:35 AM
@PeeHaa Got my 2nd $100 donation during stream!
 
 
4 hours later…
 
5 hours later…
10:04 AM
PHP 8 is missing from the version info line ・ Documentation problem ・ #80779
 
 
1 hour later…
11:33 AM
@Trowski Nice - silenced is pushed at opcode start and removed at end - shouldn't survive generator boundaries though :-D
 
12:03 PM
When is one expected to use zend_user_it_get_new_iterator() ?
Only for IteratorAggregate?
 
is this sentece correct?
Hello Ms. karidah, hope you're doing great ..!
Thanks for following me, I would be appreciated if introduce yourself.
 
morns
 
Good morning.
 
@Shafizadeh "Thanks for following me. I would appreciate it if you introduced yourself." Or ..."It would be appreciated if you introduced yourself." The "I would be appreciated..." part isn't right on your sample.
"I would appreciate an introduction of yourself." maybe, if you're trying to avoid the word "you" but this statement can sound rude. It's a bit more formal, and gives the sound that you're in a position of authority over the other person. If you're trying to be friendly, don't use this statement.
 
12:43 PM
So, the zend_user_it_*() API is kinda useless as it doesn't work with Generators :| so you need to stuff manually anyway
 
1:09 PM
@Tiffany Ah I see .. thanks for the tip
 
1:21 PM
@DaveRandom grand, you say?
@Girgias I wrote github.com/php/php-src/pull/4781 after @Nikic mentioned the generic scenario you face - but it's only for .deb based distros so far. I should update it, and do an .rpm version too, huh?
 
@Stephen I mean that's what I've kinda been doing: gist.github.com/Girgias/dae5d1c15e7e2b426238dcf59f5cc0de
 
@Girgias nice. IMO Having a basic "build with the vast majority of extensions enabled" automated script is quite helpful for those doing one-off patches, or those (like myself) without a lot of experience in the core itself - you want to fix a small issue in one file, but you have to spend <0 - infinity> time working out a 'standard' build from source first.
 
Yeah, setting up DBs will be a bit of a hassle I feel like :/
 
2:18 PM
@bwoebi as the Generator expert, is it possible for a PHP extension to create a generator and return it back to userland? Doesn't seem like any bundled extensions are doing that
 
 
1 hour later…
3:30 PM
@Girgias why generator and not just Traversable? If the answer to that is send() or whatever, wouldn't an interface inheriting from Iterator be better?
 
I mean I don't know what the best is, but a streeming parser returning a generator would be something I'd probably want to do anyways
 
yeh that just needs an Iterator impl surely?
 
shrugs
 
you only need Generator if 1) you need send() or getReturn() or 2) you specifically need the type to inherit from Generator - I don't think either of those are true
 
What does send() do? (NGL I'm very unfamilliar with generators)
 
3:34 PM
in which case, a bundled ext that does that is PDO (PDOStatement is traversable)
@Girgias current() but in the opposite direction
the caller can send a value into the generator instead of the generator emitting a value
$foo = yield $bar; <- it sets the value that will be assigned to $foo
 
Right, yeah I don't need that
Okay that should probably make it easier
 
the very simplest thing you could do would be to just implement Iterator but I think there are more efficient internal APIs than that
that is where my useful things to say run out though
 
Yeah there are, I'm currently working on making the functions part of a "static" class
 
3:56 PM
var_export return an empty an incomplete representation ・ DOM XML related ・ #80780
 
4:55 PM
@bwoebi The silence operator is two opcodes that begin and end it, so the yield opcode gets pushed in-between, which is why it survives the generator boundary.
 
@Trowski Which is pretty useful to implement my thing to extend @ to swallow exceptions :D
 
You monster.
 
I'm doing that with a purpose, but yeah
It is pretty... outrageous
 
Yes, I'm sure :-)
It sounds frightening on the surface though.
 
VM interrupts and fibers: is there a way to run something on every fiber on an interrupt? I guess I can get a data structures of all present fibers somehow?
 
4:59 PM
The only reason why I'm looking into that is to provide a migration path to change various E_WARNINGs into exceptions (namely I/O functions)
 
@LeviMorrison Yes, one of the module globals is a list of all active fibers.
 
@Trowski Great, thanks.
 
PHP - Soon to be part of a high fibre diet.
 
@LeviMorrison as you are working on iterators, what is the best current example to implement one for a PHP extension, not sure where to look for that, SPL?
 
morning / afternoon all
 
5:01 PM
Yahallo
 
@Girgias What sort of iterator?
 
I'm working on my CSV extension, and each iteration would give the next row from a source string
Currently it does string in array out, but someone suggested to turn that into an iterable because for large files having a massive array in memory ain't feasible
 
You will want the internal iterator API for performance, but it isn't required.
 
Yeah I supposed that, thanks will have a look
 
It hasn't been GA'd obviously, so it may have some bugs somewhere, but it passes UndefinedBehavior and Address sanitizers.
It does handle some fun edges like calling the constructor without args. The important thing there is to not segfault.
 
5:06 PM
Eh, I probably should add ASAN/UBSAN to my build system :|
 
Oh definitely -- it helps you find memory issues early and often.
Modern versions can do ASAN+UBSAN in one build:
 
Is it just by passing some flags to CFLAGS?
 
CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' \
LDFLAGS='-fsanitize=undefined,address' /path/to/configure ...
 
I'll write that down
 
Then add --asan to your args to run-tests.php.
 
5:33 PM
@NikiC Any idea why zend_interrupt_helper_SPEC has ZEND_VM_ENTER(); and ZEND_VM_CONTINUE();? Shouldn't the VM just go back to what it was doing?
Context: I'm trying to trigger the interrupt check before popping off the top-most fcall on the stack and handling exceptions, because that makes certain tools that use VM interrupts more useful, like profilers.
However, I'm segfaulting and I'm pretty sure it's because I don't understand these macros, and I partly don't understand these macros because they get conditionally defined to different things, sometimes with drastic control flow changes.
 
5:50 PM
@Girgias not … really
@Trowski yeah that's what I said :-D
 
@bwoebi Turns out I probably don't need it according to what Chris said
 
just that it should not leak (but it does, apparently)
 
@bwoebi I understood what you originally said as modifying a single opcode, but I guess I read it wrong.
I noticed it because I have the same problem in fibers, but it definitely should not leak there.
What's the recommended way to get a int from a zend_ini_entry value?
Or more to the core issue, I want to get the current error_reporting value in case it's been modified by ini_set.
 
@Trowski EG(error_reporting)
Also you might want to look at the ZEND_BEGIN_SILENCE VM handler (in zend_vm_def.h) for how it deals to not suppress fatal error
 
6:11 PM
@Girgias In my case that has been modified within a fiber and I want to know what the value should be.
 
Oh you need to save it before
That's what @ does, it saves the value, overwrites it, and then restores it
 
I can save it, but if it is later modified with ini_set, I'm not getting that value.
 
6:43 PM
@Trowski you need to save the value when switching the fiber and make it part of the internal fiber data
 
@bwoebi Yep, I did. However if ini_set is called during fiber execution, the restored value is not the new value set by ini_set. Not sure if I care though.
I feel like that's a case like the @yield generator. No one is actually going to write code like that.
I'm sure that problem has existed since 5.5, and no one noticed.
 
@Trowski yeah, but with fibers you can invoke a function with @, which then does Fiber::suspend()
which is a much more legitimate case
 
@bwoebi Yes, and that case I fixed.
 
then it's all fine :-D
 
@bwoebi Any idea why this is an array of two opcodes instead of defining it once? github.com/amphp/ext-fiber/blob/master/src/fiber.c#L998-L1002
Changing it to defining it once appears to work fine, but that code was from another extension that defined an opcode, so I didn't question it when I wanted to get things working.
 
6:54 PM
@Trowski there's no reason to
It depends on the exact case, e.g. if your opcode throws
but yours doesn't
 
@bwoebi Ah, ok, that makes sense, otherwise opcode - 1 would be invalid on the throw, if I'm understanding how that part of the VM works.
 
@Trowski something along these lines, yeah - that's why the exception handler (ZEND_HANDLE_EXCEPTION) is also defined thrice
 
I wonder though for callling exit() in a fiber, I don't know if I have a test for that.
 
@Trowski but you catch EG(exception)
 
Ah, right. Added a test for good measure.
I don't necessarily clear the exception when I check EG(exception), that's not a problem?
 
7:05 PM
@Trowski but you rethrow it - so all fine
 
7:19 PM
@bwoebi This points to the second array element, no? github.com/amphp/ext-fiber/blob/master/src/fiber.c#L1009
 
7:42 PM
@Trowski I don't get what you mean?
 
@bwoebi Code inspecting that zend_function may try to access fiber_run_func.opcodes[1] if it wants to use last_try_catch, correct?
Which then I would think it could be 0 instead.
Or is that related to the try_catch_array size?
I still am not totally clear on how that works.
 
I'm a bit confused as to why that has a non-empty try_catch_array at all
 
That's what I'm trying to figure out myself.
I was trying to decided if it was compatibility if the fiber threw, but that doesn't happen from that opcode, that only happens from start/resume/throw.
So I'm thinking it's a leftover from some other approach.
@bwoebi It would be really nice if github.com/amphp/ext-fiber/blob/master/src/fiber.c#L1005 could be ZEND_INTERNAL_FUNCTION for backtraces, but that might be something I'll have to fix when added to core.
I'm not sure I can fix that as an extension.
The problem is printing [fiber function](0) in backtraces. It's otherwise fine, but that's ugly and confusing.
 
7:57 PM
@Trowski how is a backtrace currently looking like?
 
Fatal error: Uncaught Exception: test in %s005-failing-fiber.php:%d
Stack trace:
#0 [fiber function](0): {closure}()
#1 {main}
  thrown in %s005-failing-fiber.php on line %d
For an exception thrown from a fiber resumed from main.
 
@Trowski and what do you want to have instead?
 
@LeviMorrison makes it more flexible iirc
@LeviMorrison That is, by default it'll just continue, but you can also do something more sophisticated
 
@bwoebi Replace [fiber function](0) with {fiber}. Then it would be nice if the stack trace of the code that resumed the fiber was included, but at the moment that seems to cause segfaults, not sure why.
 
8:12 PM
That is, switch to a different function for example
 
9:00 PM
@Trowski yeah, that won't work without changes to the trace printer - the former at least
At least the trailing parenthesis
@Trowski heap.space/xref/PHP-8.0/Zend/… this particular call could be made more dynamic so that custom extensions can have their own placeholder frames there
 
9:31 PM
@NikiC Ah, sorry, by "continue" I didn't mean to the next opcode VM style, I just meant "return to where I was, normal C style".
I've stuck an interrupt check here, for example, so I can check it before popping the internal function off the top so I can know which internal function was being called, like pdo::exec, when the interrupt triggered.
 
I see
Well the VM_CONTINUE is just continuing
And probably people could be convinced to drop that VM_ENTER, as I don't think anyone actually makes use of it
In which case just calling the interrupt handler should be sufficient
 
I'm rebuilding now with this inserted:
void ZEND_ALWAYS_INLINE zend_vm_interrupt_check_todo_inline(void) {
       if (UNEXPECTED(EG(vm_interrupt))) {
               EG(vm_interrupt) = 0;
               SAVE_OPLINE();
               if (EG(timed_out)) {
                       zend_timeout();
               } else if (zend_interrupt_function) {
                       zend_interrupt_function(execute_data);
               }
               LOAD_OPLINE();
       }
}
(basically the same thing inlined without those other macros)
Will find out if it still causes sigsegvs.
@NikiC Excimer calls PHP code from the interrupt, I think?
Forgot about that specific detail, been a while since I looked.
 
10:39 PM
Okay, sigsegvs gone with that version.
So yeah, my lack of knowledge in this area is apparent...
 
11:21 PM
@Trowski I'd just leave it as is - until we get the fiber rfc accepted
 
@bwoebi Yeah, that's what I was thinking. There's a few other other areas where core can be slightly modified to play better with fibers.
e.g., The extension overloads the catch opcode to immediately rethrow FiberExit, which I would modify core to treat similar to UnwindExit.
 

« first day (3781 days earlier)      last day (1164 days later) »