« first day (3858 days earlier)      last day (1072 days later) » 
00:00 - 22:0022:00 - 00:00

12:26 AM
@CharlesSprayberry ftr I intend to apply some thought rather than just picking holes (but tomorrow)
 
@DaveRandom No worries! Should enjoy your weekend... and feel free to poke as many holes as you'd like. Need somebody besides myself looking at it with a critical eye
 
so I'm gonna have to call the entire north American continent out on something here - if you are able to "poke" a hole in a garment then you you need to take a hard look at your knitting skills.
 
12:52 AM
o/
@DaveRandom wat?
 
I pick threads
I don't poke them
Carly Rae jepson gives her number to random dudes but she seems ok with it
 
Have you seen the clip for "Really really really like you"?
It is legit hilarious
 
1:18 AM
I've been stuck listening to opening songs for TV shows and video games: Westworld, Star Trek Discovery, House, Metroid Prime
Then that scene in Star Trek Beyond with Beastie Boys' Sabotage
 
 
1 hour later…
3:09 AM
review will be appreciated: github.com/azjezz/php-rfcs/pull/2
 
 
4 hours later…
7:02 AM
@JoeWatkins good post on internals, big +1 for the move. It should have additional positives as closing old bug reports which simply is not relevant anymore aswell as old FR annnnnnd hopefully keep people like Reindl away from spamming it on a per monthly basis or whatever it is
 
@Kalle ta ... can I get that +1 on the thread, for consensus ...
 
Of course
@JoeWatkins there you go
 
7:18 AM
ta
 
Time to crawl back to the observer post :>
 
8:02 AM
@SaifEddinGmati @JoeWatkins your input is the most relevant here, do you think we should support this special behavior for interfaces, or not?
 
don't think interfaces should be supported
24
A: Why are interfaces not able to be marked as sealed?

Eric LippertThe purpose of sealing a class, or a virtual method of a class, is to lower your costs. Designing for inheritance is expensive, and if you do not do it correctly, it is dangerous. There are security, correctness and robustness consequences to improperly designing for inheritance, so if you do not...

 
"sealed" in C# is different tho
 
details may differ, but this
> The purpose of sealing a class, or a virtual method of a class, is to lower your costs. Designing for inheritance is expensive, and if you do not do it correctly, it is dangerous.
is the reason for doing it ...
 
sealed in C# is final in PHP
PHP already doesn't allow declaring interfaces final
 
yep, so why should sealed be different ?
sealing is a kind of finalizer, and the purpose of sealing a class is still to lower costs associated with designing for inheritance, and so the reason that there's no incentive because no associated cost is correct, and applicable ...
 
8:08 AM
because unlike C#, if a type is sealed in PHP, it would permit a subset of types to inherit from it, in C#, there can't be a subtype to a sealed type.
 
> lower costs associated with designing for inheritance

---

exactly that.

a sealed interface doesn't mean "no one can inherit from this" ( like C# ), it means "only X, Y are the possible subtypes"
 
it's still doing the same thing
 
how is that?
 
it's not lowering costs to the same degree, but it's still lowering cost ...
 
8:13 AM
they are still useful ( given result -> success|failure example in the RFC ).

and PHP already has 2 builtin interfaces that act as they are sealed.
DateTimeInterface -> DateTime|ImmutableDateTime
Throwable -> Exception|Error
this is an opportunity to bring more consistency in the language IMHO ( i.e what can be done in the engine, can be done in user-land ), while complete consistency will never happen probably, it's nice to remove some special cases, and make it easier for extension authors to be able to seal interfaces ( e.g: ext-date doesn't have to check for inheritance itself, now it can just mark the interface sealed )
 
how many interfaces has php got built in ?
it's quite a few, 2 is a small number, it doesn't exactly make the case ...
 
21
so ~9.5% are sealed
 
yeah, well one of them was structured like that without the input of any of internals, one of those belongs to core ...
 
( 21 from var_dump(count(get_declared_interfaces())), this probably depends on the installed extensions .. etc )
@JoeWatkins well, can see where core get the idea from :p 3v4l.org/hSi5R
 
being able to write the patch doesn't mean I know how to design a language best, my opinion is not worth more than anyone else's, this isn't a technical question of what will work and what won't, those questions I'll answer and you have to listen ... but you don't have to listen to me here at all ...
I'm wrong, all the time ... this could be one of those times ... easily ...
 
8:26 AM
I would listen regardless, as you have more experience that me in this field.
internals mailing list haven't been really helpful on this subject, most emails are about why final is bad even when i made it the subject of the thread at the start 🤷‍♂️
 
that's quite typical, people tend to engage when votes open ...
 
well, that's kinda pointless IMO, if you disagree with the design, you should speak before the RFC is finalized and open for voting.
the best approach IMHO, is to make interfaces behave same way as classes, seal Throwable, and break BC, but many people won't like the last point, considering too many packages now claim to support php >=8.0/^8.0, and they have interfaces extending throwable.
 
it probably makes sense, when you look at the number of rfc's that have been started, and then never actually voted on ... voting is when it becomes a real possibility ...
the bc break is hard to accept
 
hence why i came to the idea of this different behavior for interfaces, which would be BC-friendly
 
yeah, it seems reasonable, if you're going to support interfaces
gotta go afk, lata
 
8:40 AM
later 👋
 
9:07 AM
@SaifEddinGmati I don't know if the result example is that good. In other languages like f#, the result type is a union of result<v, e> = ok<v>|error<e>. Meaning you wouldn't really need an interface for that.
 
you need an interface for the same reason you need the type alias* :)
to be able to use for type hinting
 
Not sure I can follow your explanation :)
 
class success<T> { }
class error<T> { }
alias result<T> = success<T>|error<T>

is same as
sealed interface result<T> permits success, error {}
class success<T> implements result<T> { }
class error<T> implements result<T> { }
with one exception, using an interface you can force both success and error to have the same API.
 
Yes, but if you are in control of both result en succes, you don't need an interface to force that. The error shouldnt even know about the ok type, since the result alias knows it is either a success type of a specific value or an error type of a specific exception type.
The other example with the operating systems make more sense to me.
Anyways, it's just my five cents. The rfc looks nice!
 
 
2 hours later…
11:43 AM
@NikiC can I get some public input on that thread please, when you have time ...
you know I'm not even sure I agree with the definition of PHP as a big project in the sense that matters here, when it comes to active contributors to php-src, we actually have a small team, not a big team at all ...
 
 
2 hours later…
1:38 PM
Eugh, I typo'd github import from github, but I meant gitlab import from github - docs.gitlab.com/ee/user/project/import/github.html
 
1:58 PM
Oops
 
2:10 PM
@VeeWee It's probably not possible in PHP, but in general an advantage of an ADT or sealed class or similar is that you can know at compile time if a match statement is exhaustive, and tell the dev up front "yo, you forgot to handle the error case here."
 
3:02 PM
What's the correct name of the type in PHP, int or integer?
or why does php.net/manual/en/function.gettype.php report integer instead of int?
 
cmb
int is correct; gettype reports integer for BC reasons; use get_debug_type() instead
 
@cmb Surprised not to see that function listed in the manual
 
cmb
blame the lazy doc team ;)
 
hrmm... is there some place that talks about how to get started with documentation for PHP? I can't contribute to the internal codebase because I don't know C but I can write documentation for stuff like this.
 
3:22 PM
@CharlesSprayberry The doc-base repo readme has basic instructions that should help you getting started: github.com/php/doc-base - if you get stuck shout here and someone will surely help.
 
@CharlesSprayberry I've separated Injector into smaller pieces now and I think it's working, next step is writing a nice API to configure the individual pieces in a single place. :)
 
@kelunik Nice! Will take a look at it soon
@AllenJB Cheers!
 
@CharlesSprayberry I haven't pushed anything, yet :D
 
@kelunik Ah, let me know when you do. Definitely interested in the stuff you're doing there. Want to start working on migrating Auryn stuff to Amp whenever you're done.
 
Is it just me or is doc.php.net missing a header menu? I'm sure it used to have one
 
3:33 PM
$context = new Context();
$context->add('newsletter_service', new AutomaticFactory(A::class, (new ArgumentRules)->name('std', new Value($stdClass))));

$a = $context->getByType(A::class);
^ @CharlesSprayberry That's how it currently looks like, but it's a bit verbose and not easily discoverable via autocomplete.
 
cmb
@AllenJB yes, that is broken for a while
 
@kelunik Interesting. I think it is ok for the base injector to be a little verbose if there's some benefit in it being that way. Could always have wrappers that provide an API that's easier to work with.
 
@CharlesSprayberry Yes, that's what I'm writing now.
The Context is now pretty much logic less and only 64 lines.
 
Nice, that sounds like a pretty big improvement compared to what it was before
I had looked through it a couple times, never enough to fully understand what was going on in there
 
It was a quite complex class without any way to extend it except for the ways intended like delegates & co.
 
3:48 PM
Yea
Kinda glad the work I'm doing with the async testing framework took me away from the injector stuff I was working on. Sounds like the new Amp one is going to be a significant departure in how things work.
 
Does anyone have a good word for the opposite of singleton? Spring uses prototype.
 
Yea, that's what I see it referred to in my professional apps... we're using Spring Boot
I don't think the name makes much sense but perhaps there's something I'm not aware of with the meaning of the word
 
@Girgias This free is incorrect. That pointer is freed by the zend_llist.
 
@CharlesSprayberry I didn't initially plan that much of a rewrite, but then I wanted to write a framework that needs the kind of stuff that wasn't possible with the old design.
 
Manyton is probably not that much better either
@kelunik I get it. Sometimes things need to be rewritten and changed. Will be interested to see what a migration from Auryn -> Amp injector might look like.
 
3:52 PM
@CharlesSprayberry I wanted to write a compat layer, not that I need it, but because I wanted to see whether all features are still supported.
 
@kelunik Probably not a bad idea for that reason and potentially increase adoption
 
4:13 PM
@NikiC Doh! I guess I’ll be less liberal with merging from now on. :-)
 
Limit usable usernames for MySQLi ・ MySQLi related ・ #81023
 
4:30 PM
@Trowski Huh, surprising ASAN and co didn't pick that up, do you have a regression test that you can add?
Also feel free to commit the fix, you found it :-)
 
@Girgias I don't see it locally either with ASAN, I must not have quite the same build as azure: dev.azure.com/phpazuredevops/PHP/_build/…
 
Strange, might explain why my shutdown refactor also dies
I'll try to come up with a test but am busy today :-/
 
I don't think another test is necessary, that's what the sanitizer is for. Though I don't immediately see why I'm not seeing it locally.
 
4:58 PM
@Girgias Which tests are you running for the register shutdown refactor?
 
All of them
But on the ext/standard/general_functions one it works just fine
But when I run all of them some tests hang and never terminate
And I have no indication as to why
 
\o
@Girgias tried attaching to the hanging process ?
 
@CharlesSprayberry Do you clone the injector and add rules for a specific case?
^ /cc @Danack I think you mentioned something like that, no?
 
@Girgias Bored this morning, I'll give it a go.
 
@Trowski Are you running with --asan?
 
5:13 PM
@JoeWatkins I actually don't know how to do that, but no I didn't
 
sudo gdb -p PROC
 
@NikiC Oh, no, I was getting other sanitizer errors without a flag, so I didn't realize a flag was necessary for all checks. Now I get the error locally. Thanks!
 
(then send interrupt, CTRL+C)
 
@kelunik No, most of my designs lend themselves to just using define during the bootstrap phase and not needing to have special cases. That being said, when I have had to do that I normally just pass arguments to make.
 
@Girgias Which test hangs?
 
5:22 PM
One of the CLI tests
easiest way to find it is run all the test without parallel and it will hand on one of them
Bug 47xxx or something like that IIRC
 
The one you modified already?
Oh, no, you said cli tests
 
I can't reproduce any hangs
 
@Girgias I assume the register shutdown function isn't getting called and the test hangs in the cli server polling.
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP
  * frame #0: 0x00007fff738010fe libsystem_kernel.dylib`__select + 10
    frame #1: 0x0000000106dfc886 php`php_cli_server_poller_poll(poller=0x0000000107da61c4, tv=0x000000010c7af720) at php_cli_server.c:817:9
    frame #2: 0x0000000106df55ae php`php_cli_server_do_event_loop(server=0x0000000107da61c0) at php_cli_server.c:2626:11
    frame #3: 0x0000000106df4392 php`do_cli_server(argc=7, argv=0x00007ffeeac2d298) at php_cli_server.c:2758:2
 
@Trowski I mean I suppose, no idea why as I didn't really touch a related part to that,
 
Oh, looked at the other process and saw this:
frame #2: 0x00000001103806a1 php`php_stdiop_read(stream=0x0000000117470800, buf="\nFatal error: Uncaught TypeError: proc_terminate(): Argument #1 ($process) must be of type resource, string given in /Users/aaron/Developer/php-src/sapi/cli/tests/php_cli_server.inc:94
Interesting…
 
5:32 PM
are you both on mac ?
 
No I'm on Fedora
 
hmm, can't reproduce in any configuration here
 
$context = new RootContext;
$context->add(A::class, ...);
^ @CharlesSprayberry @Trowski I thought about making the RootContext immutable (renamed from Context, because that's an interface now), but I think people might be confused and write code like above, wondering why their definition has no effect. Thoughts?
Methods would return a new instance like in PSR-7.
 
@Girgias Ah, think I see what's happening. Can I just push to that or would you rather I make a PR?
Fixed that test at least. Should fix any other instances.
 
5:48 PM
@Trowski Push directly onto that :-) I'll pull and see if it still happens
 
@kelunik Ohh, I think I see. To fix this we'd have to $context = $context->add(A::class, ...);
That is interesting. I do enjoy me some immutability
I've never really thought about it with the container itself
Would there be any performance implications? I've always imagined this as a fairly heavy object you wouldn't want copying around a lot
 
@CharlesSprayberry It's an additional object per modification of the context, but it can be a shallow copy if everything within it is immutable as well.
I need to do some performance testing later anyway.
 
6:03 PM
On the surface I like the idea. I'm not as worried about somebody using it in a non-immutable manner like you described above... as long as the documentation makes it clear that the context is immutable and how you should properly use it. If they're new to the library they should be reading documentation
And if they're migrating from Auryn this is probably really minor compared to the other changes
And again you should probably be reading the documentation :P
 
@Girgias Ugh, maybe I shouldn't have rebased it :P
Caused some git headaches, but I got that sorted.
 
@Trowski Huh, is the copy necessary because otherwise it gets destroyed by ZPP?
Wondering why this works with the tick thing then
 
@Girgias The array of zvals is only valid during the fcall.
@Girgias Uh… I should maybe look at that, lol
 
@Trowski I mean my understanding is that the zvals are stored in the fcall and will be used for the calls, but you can replace/restore them with some of the other APIs, but I might be missing something
 
Seems no test using register_tick_function passes args, so the error never surfaced.
@Girgias The array of zvals there is a pointer to the args on the stack. If you want to persist the array after the fcall, the zvals need to be copied elsewhere.
Yep, if I pass a param it blows up. Will fix.
Is it fine to pass NULL to efree, or should I wrap in a null check?
Wasn't sure if ZendMM could complain, but it appears the semantics are the same as free.
 
6:35 PM
ha, I thought that was merged already ...
 
@Girgias The prior implementation allocated for the args here.
@JoeWatkins It was, fixing it now.
 
you people are confusing the fuck out of me
 
Ugh, maybe… what are you talking about?
 
nothing nothing, I was trying to reproduce in master branch, should that have been possible ?
 
No, there was no test for it.
So fixing and adding test.
 
6:41 PM
ah I see
we have a nice api for some of this ...
zend_fcall_info_argp will copy args, zend_fcall_info_args_clear will clear them ...
 
@JoeWatkins I'm essentially doing this again.
 
also, I'm sure you're just debugging, but assertions should not have side effects
 
haha, nice, I can just replace with zend_fcall_info_argp.
@JoeWatkins Oh yeah o_o
 
that reads strange, the thing you allocated is the callable, dtor that
same
 
7:01 PM
I'm looking at the docs, I have used doc-base/configure but am not immediately seeing a mechanism to render them out to preview?
 
Interesting that zend_fcall_info_argp isn't used anywhere in php-src
 
@Trowski Ohhhhhhhhh, okay well thank you for spotting this :-)
 
@Girgias Slightly better fix incoming. Want me to squash my commits?
 
I'll squash rebase and mark you as co-author :-)
 
7:03 PM
Sounds good.
 
Thanks Joe.
 
@Trowski ooops
 
@NikiC Let's just deprecate tick functions :P
 
2 days ago, by NikiC
@Girgias Also, you remind me: We should totally deprecate ticks
 
7:24 PM
@JoeWatkins Those should be dtor'd at the end of the function regardless, no?
Regardless of if adding the callback failed, that is.
Heh, nope :)
 
you got there, I only looked at diff, was checking ...
 
Building the docs on PHP 8 seemingly throws several thousand E_WARNINGS phpdotnet\phd\Format::SQLiteExample(): Argument #1 ($context) must be passed by reference, value given
 
@JoeWatkins I later realized zend_fcall_info_init did ZVAL_COPY_VALUE, not ZVAL_COPY.
 
zval_ptr_dtor(&shutdown_function_entry.fci.function_name); wasn't wrong exactly, but zval_ptr_dtor(&callable) is more obvious.
 
7:38 PM
@DaveRandom lol
 
yeah, just reads strange ...
 
@Girgias All fixed up I think.
 
@JoeWatkins Are you sure? zend_fcall_info_args_clear looks like it might cause havoc if that's not null.
 
7:47 PM
I guess I didn't go deep enough down the macro rabbit hole.
 
I'm pretty convinced I'm actually a rabbit
I can only see your faces from down here ...
 
Unfortunately I already did something similar in master, bah :P
 
you'll quickly remember these sorts of details, I remember them
 
There's only so much room up there. If I fill my brain with all the PHP macro behavior I'm likely to forget my wife's name.
 
i.imgur.com/6y86VCJ.jpg How I feel trying to understand PHPs quadrouple nested macros
 
7:52 PM
any tests cover that line ?
 
okay
lgtm
 
@Girgias If you want to rebase and double-check that all the tests pass, I think it can be merged.
 
@Girgias can you clarify what "more sane" means? the PR description isn't really helping :)
 
@MarkR CLion has been helping me :-)
 
8:06 PM
presumably just increasing clarity, and when you look at the patch in context, every little bit of clarity is helpful to understand just what is happening here ...
 
@ramsey Really? my CLion falls dead when I try to follow the macros. It can't even find things like IS_TRUE
 
@ramsey Is there something I have to do to get it to link them correctly? They work in the Zend directory, but outside it doesn't know what they are.
 
@Trowski Hmm... it's possible that I haven't gotten far enough to notice those problems.
 
@MarkR Does it work within Zend for you? That's the only place the macros can be followed for me.
 
heap.space is your friend ... I've never heard of anyone using an IDE on php-src ...
 
8:07 PM
Though, I'm working on a post that tells how I set up CLion to work within it.
 
CLion is the first one that doesn't completely fall down on php-src.
It auto-completes most things within the Zend directory. Outside of that though I may as well be using a text editor.
 
I just still use a normal text editor ... gedit ...
 
I often use vim with heap.space :-) Just trying out something different to see if it helps
 
I find heap.space a hundred times easier to find things than the IDE I paid good money for x_x
 
yeah we love grok, it's a shame it's java ... shhh, don't tell anyone ....
@ramsey I was going to mention, have you got a milestone/label that you're using, and you can add labels, right ?
 
8:13 PM
there is an 8.1 milestone already that I've been using, and I have been adding labels
I merged a few things, but I think I was over-eager on the merging :-)
 
to avoid the sort of mistake with abi breaks, it may be an idea to add to the milestone/label things you intend to merge a couple of days before you actually do it ... other people that are looking can then check it's all good ...
nah, don't worry about that, be eager, but a little time between adding the label, maybe even pinging someone if you're not sure about abi or whatever ... but keep it up, we can revert mistakes, it's no problem ...
 
Sounds good. Thanks!
For that particular issue, I didn't consider the one-line change to php_globals.h as being problematic, since the feature no longer even works, but this is also the first time I've learned about ABI and ABI breaks
With an ABI break like that, can it even go into 8.1? Is that something that has to wait until 9.0?
 
link, I've forgotten the details ?
 
ABI breaks are fine in minor versions.
@ramsey Extensions compiled against the prior version need to be compatible.
 
8:22 PM
If the positions of the struct change between minor versions, then that breaks extensions, right? Or they just need to be recompiled?
 
what was this merged into ?
 
@beberlei Mostly using fci/fcc instead of a custom mimick of that
@Trowski Will do, thanks for the help :D
 
it looks fine for 8.1
 
@JoeWatkins originally merged into master, but after some discussion it sounded like it should really have gone into PHP-8.0, so I reverted it in master and committed it to PHP-8.0. Then, @NikiC reverted that because of the ABI break.
 
oh I see, I can't see that happening and was confused ... it's fine in 8.1
 
8:25 PM
It seems that most everything can go into 8.0 (including a note in UPGRADING), but the ABI break can go in 8.1
 
Preserving ABI is important, but depending on what "feature no longer even works" it may be worth breaking it to fix it. That would require more conversation though, and I didn't even look at what feature you're talking about.
 
urm, I wouldn't do that ... just commit as is in 8.1
 
since the INI property no longer has any effect in 8.0
 
oh what a mess
 
right :-)
 
8:27 PM
okay yeah
 
@ramsey I think there's still inaccurate items in NEWS and UPGRADING.
 
@ramsey Land in master, update docs, done.
 
👍
 
@Girgias No problem, was a good excuse to learn more myself.
 
As a matter of general policy, code cleanup should always go to master only.
 
8:29 PM
this includes test changes, in general ...
 
(Unless there's some particular reason to deviate, like a change introducing a lot of merge conflicts if it doesn't land on all branches.)
@LeviMorrison I don't think we've ever broken ABI compatibility in a patch release, or if we did, it was before my time
I think this is pretty much the only hard rule we have ^^
 
Again, I have no clue what "feature" we are talking about, but fixing a legitimate regression can be more important than ABI.
Ideally all such issues are caught in prereleases and such, obviously.
 
it pretty much is the only rule we have that we stick too ... we have others, but not always possible to abide by them ... but here, there's never really a good reason imo ...
 
@JoeWatkins The closest to a "good reason" I remember is when PHP 5.6 limited the size of constant arrays to 2^16 due to a uint16_t for the AST child count... we didn't end up fixing that one though.
 
cmb
@ramsey ABI breaks are always okay for next minor, since you can't use extensions build for previous minor anyway
 
8:47 PM
@NikiC yep, unsigned short remains ...that was noticed ... late ...
 
If anyone from the docs team is around, can I request someone take a glance at github.com/php/doc-en/pull/591 and give me a "seems right" or "you suck at docs"
 
looks like docbook
 
Ta @cmb
 
wow, docs have ci
 
cmb
well, the rendering is not done there :(
 
8:54 PM
still ... ci ... on docs ... breaking the build was always the worst thing about working on docs, and even though the build script tried to make you feel better about it, it fails at doing that ...
 
@LeviMorrison In this case, fixing the regression would not break ABI. The issue is that log_errors_max_len effectively does nothing in PHP 8.0. That is the regression, but no one has complained about it, either. The PR in question removes all mention of it from the code base and from the INI files, but it also removes it from php_globals.h and main.c, and that breaks ABI.
afk
 
and nothing makes you feel better when you break the actual build, and it took hours for someone to fix it usually ... we are spoiled with any ci at all ...
I'm not familiar with how you might test the rendered content, is that a thing ?
 
cmb
you would need to pass thru PhD, and then could check the XHTML manually; it's not super important, but somerimes I render locally and comment with a screenshot on PRs
 
Something I seem to need but am not sure on, do I need to call configure every time I make a change in order for PHD to pick it up?
 
I guess just doing phd would be a good baseline ... I'm not sure exactly in which strange ways it may render strangely but still pass that test ...I used to get odd css stuff going on, but probably I was doing it wrong ...
@MarkR yes
 
9:02 PM
Ok, ty Joe
 
Do you think anything like the scalar_types plugin will ever be supported by PHP itself? Has there been any recent discussion about this?
 
It seems well maintained and I'm interested in using it as is. The problem for me is it is unusable unless Psalm can understand it. I know it doesn't yet, but I'm wondering how possible that sounds. I'm willing to do the work necessary to make it happen. Have been asking for help from them and probably will hear back soon, just wanted to get other people's thoughts here too...
 
unlikely to be official supported by the psalm, you should create a plugin instead.
 
There's been at least some side discussion recently about adding a type declarations to PHP itself. So maybe PHP will end up with a userland version eventually
 
9:08 PM
Yeah, I can see 3 avenues, 1) Create a plugin 2) if not possible, make plugin system more powerful, 3) Built support directly into Psalm.
 
@still_dreaming_1 you mean github.com/nikic/scalar_objects, right?
 
@SaifEddinGmati yes
 
yea, that can't be part of psalm itself, you should create a plugin instead.
 
at some time, php may allow calls on primitives, I don't love it, but it may happen ... but what won't happen or shouldn't happen is allowing user code to register handlers
 
That was my first though, and I'm trying to make one, but I can't get a self made Psalm plugin to work at all or do anything at all.
 
9:10 PM
@JoeWatkins You mean like... github.com/nikic/scalar_objects
 
yeah, that's what the question was about ...
oh I saw scalar_objects, not scalar_types ...
 
It's as if my plugin won't even get invoked. I tried looking at other plugins for comparison. I guess I will have to post the entire project to github and get some eyes on it to help me.
 
@still_dreaming_1 yea, as long as user land is allowed to register handlers, you can't make it work using static analysis, you can't tell which handler will be registered, event if you scan for register_primitive_type_handler calls, it doesn't mean that it will be included at runtime.
 
Someone, I forget who, came up with an effective way around that. By declaring which one to use per-file.
 
cmb
@MarkR configure creates a single file (.manual.xml) with all contents; PhD renders that file
 
9:13 PM
@still_dreaming_1 here's an example, if you need any help, you can reach out :) github.com/php-standard-library/psalm-plugin
 
use MyHandlers for string;

"foo"->doSomething($a, $b) === MyHandlers::doSomething("foo", $a, $b)
 
@MarkR no more declare();s please
 
You've got a) strictly internal function tables only b) declares or c) global state. Pick your poison.
 
cmb
is char buf[32]; printf("@%.32s", buf); incorrect? i.e. does buf need to be NUL terminated?
 
9:15 PM
@SaifEddinGmati Then you have to decide how you're going to handle the elephant in the room that is multibyte
 
@CharlesSprayberry Pushed: github.com/amphp/injector/commit/…
 
@kelunik \o/
 
"foo"->length() // mb
b"foo"->length() // sb
 
So... redefine strings. It's currently the opposite way to what you suggest
 
"foo"
b"foo"
re"/foo/" ..
 
9:18 PM
@CharlesSprayberry There are still many TODOs and FIXMEs, but feedback on the API is definitely welcome.
 
re"/foo/"->matches($var) would be nice :p
@MarkR both return a string, but with different handlers attached to them :)
 
@SaifEddinGmati Thanks. Well, won't be able to work on it again until Saturday, but will definitely be reaching out for help. The most frustrating situation in programming is when you can't get the code to provide any feedback about what it is or is not doing. That's how my plugin is, it's as if it's completely ignored.
 
@kelunik For sure, will take some time to look through it over next few days. I'll let you know if I notice anything.
 
and b"foo" is BC-friendly 3v4l.org/Z1PCP
 
Also, there are still missing features, like I haven't rebuilt executing arbitrary callables nor prepare, yet.
Actually, I'll probably not add prepares again, because they break things like proxies or we need special proxy support, which I'd like to avoid. A proxy should just be a Provider like everything else.
@SaifEddinGmati The issue is changing the default "" to be anything other than b""
 
9:26 PM
@kelunik what difference would it make?
( to the end user i mean )
 
@SaifEddinGmati 3v4l.org/gh0uZ not so much
Considering 99% of manipulated strings in PHP come from outside of the source code
 
or we could add support to template literals and let people define tags.. :p developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…
 
@SaifEddinGmati I'd break everything that relies on the lengths being in byte not characters.
But feel free to find a PHP 6 binary somewhere: web.archive.org/web/20090403051843/http://us2.php.net/manual/en/…
 
how is that? if "foo"->length() would return characters length .. so if you are using strlen("foo"), you code would still work the same.
( we are talking about scalar object handlers here being different )
 
That'll work, but I guess there will still be enough mistakes during migration. :)
 
9:44 PM
there will always be
 
PHP strings are byte arrays and they should remain that way unless you plan to re-engineer to work in chars (i.e. PHP6)
imho
 
cmb
what is a character?
 
OK, sorry, unicode code points
 
@kelunik Interesting. Haven't done a lot with proxies but I have made use of prepares for various things that just don't work with constructor injection.
 
that is my definition of a "character"
 
cmb
9:47 PM
yep, but this isn't often what users expect
 
*PHP users
but yes, agreed
I don't even know what I think about this btw, sometimes I like the simplicity of string index = byte offset, sometimes I wish PHP knew what I meant rather than what I wrote :-P
 
cmb
we can add some AI, can't we :p
 
I do a lot of low level binary (networking) stuff, but also PHP is primarily used for the web, where things are communicated in text rather than bytes
 
cmb
well, I love and hate PHP's string handling
 
s/PHP/reality/
I love PHP, I love C#. They took polar opposite approaches to this, neither works for everyone, but I do not see a middle ground that works for anyone
 
cmb
9:55 PM
I almost exclusively use UTF-8, so I prefer not to covert to UTF-16. But then again, I easily forget to use the right functions …
 
UTF-8 is The Correct Answer™ for anything web-related :-P
but it's an encoding, broadly unrelated to how a character processor works
UTF-8 is essentially a (very clever) compression algorithm
 
cmb
$string = substr($string, 3); // remove 3 leading chars
 
00:00 - 22:0022:00 - 00:00

« first day (3858 days earlier)      last day (1072 days later) »