« first day (3480 days earlier)      last day (1467 days later) » 

12:33 AM
\o/ thanks everyone who helped me, it's working
 
12:59 AM
Is it possible to access variables in C like 3v4l.org/JKdv1?
 
 
3 hours later…
3:53 AM
this is likely a dumb question, is there any way to run say a PHP script to make sure that I've compiled it successfully? I know there's make test, and I've ran that. I guess I want to make sure it's working...
just occurred to me I can set an env variable in WSL and then try that...
 
 
2 hours later…
Wes
5:52 AM
\o
 
6:40 AM
@GabrielCaruso what do you mean possible?
@Tiffany you can use the compiled binary from ./sapi/cli/php to execute a script
 
@beberlei I think I want to add a void* to the struct that holds the begin/end handlers, and to pass it to them.
It would be per handler, not per call frame, but that allows you to cache things unique to the handler, at the least.
 
@LeviMorrison ok :) are you unhappy with extended op_array thingies?
i do find it hard to match up beings and ends
with a void ptr per handler it would be much easier, even if you end up storing a linked list in there for nested calls
 
I'd need to think about it more, but in 7.4 the extended op_array thingies are only per-request, right?
They didn't used to be.
 
ooh i havent thought about that, of course zend_op_array comes from opcache
yeah lets have a ptr ;)
 
For instance, in ddtrace we'd want to store ptr to ddtrace_dispatch_t which stores (among other things) a closure to invoke either before or after the call.
I think the op_array slot thing might be fine, though -- need to see how it changed on 7.4 in more detail.
 
6:56 AM
yeah we call it a tracer_frame_t and it has start + stop callbacks
 
On 7.4 it's no longer unique to zend extensions, and it's in a map_ptr so it's request-scoped data.
 
i have a patch for our internal changes that would make the instrumentation API work with tideways, i will clean it up and send you to see how i did it with op_array extended
 
I think we need to at least rename the API -- I think I mentioned this before. It's really an "observer" type thing, and there are other things we'd want to observe such as exceptions being thrown and caught (dtrace does this, for example).
Even if we keep the name "instrument" instead of "observer", it should probably be zend_instrument_fcall instead of zend_instrument only to allow API expansion.
Make sense?
 
yes makes sense
i like instrument more than observer, but zend_instrument_fcall is definately a good idea
 
Okay, I'll prepare a PR for at least that change.
I've been trying to think of an easy way to provide data per call frame from begin to end -- assuming the API is correct and begin/end match up, you could just do a linkedlist/dynamic array in the ZEND_OP_ARRAY_EXTENSION.
Doing it there makes it more resilient to misalignments than if it's global.
 
7:08 AM
@beberlei thanks
@Derick I got my sister hooked on FND, she's been watching it on Hulu now
 
@LeviMorrison i think observer would be right if we know the API couldn't affect things, but you can implement an AOP extensoin with this, that could affect behavior, so nits not observing anymore
 
Only if you do extra things -- you can't skip things.
It's not designed for it and IMO should be actively discouraged.
I think there's demand for AOP, but this isn't the API for it -- notably because if 2 extensions want to skip the same function it is hard to be reliable...
 
@LeviMorrison yes, only for "begin" and "after" callbacks, not around. didn't think it thorugh :)
 
7:38 AM
You can't change the number of args passed to the function, though you could misbehave and change individual args, I suppose.
 
8:23 AM
@beberlei PR opened; going to bed. Leave feedback on the PR so Sammy sees it too, thanks.
Also note that I rebased php-8-instrumentation-hooks on master, so if you pull you'll have to deal with that consequence. I need to get out of this habit when other people have the code checked out already.
 
I am preparing to move my repos (yeah fuck you bitbucket) and I came across one that's empty. It has a unique name that I remember taking a while to come up with, to name the tool, but I can find no local repo (i.e. local commits I hadn't pushed yet), and I have no recollection what I intended the tool to do.
1st world problems.
 
8:44 AM
@Tiffany We just saw the last (older) episode last night :-(
 
9:02 AM
@Girgias Don't think that's a good idea. Those functions are specifically also useful to check validity
 
9:19 AM
@Girgias Done! :)
 
@LeviMorrison don't think that it matters you rebased, i need to recompile everything anyways, because i swithc around php-src checkout often enough
 
 
2 hours later…
11:40 AM
@Derick show just ends with him cackling. I'm not sure what I expected.
 
? I meant the one were Wilson died...
 
Ooooh
Thought you were talking about the horrible grandma episode
The Wilson episode was sad.
 
cmb
12:03 PM
!!uptime
 
12:24 PM
!!irony
2
 
1:10 PM
@beberlei I meant if we could write code like that in C, I was trying to refactor a piece of code :D
 
cmb
1:21 PM
@GabrielCaruso no, that is not possible. What code do you want to refactor?
 
@NikiC Yeah Bob said that, although another mbstring question, I'm not sure I fully understand mb_http_input, can it return false when used with a SAPI other than CLI? (because there are no tests soooo) Because in that case it would make more sense IMHO to change the default value from NULL to pass_through
 
cmb
1:39 PM
@GabrielCaruso you could store the addresses of the variable in an array, and iterator over that array. Perhaps even use an array in the first place?
 
2:02 PM
@cmb I'll try that, thanks!
 
2:25 PM
Hi everyone, today I am looking for an example of how to call a built-in PHP function from my own PHP extension written in C.

For example, consider this PHP code:
```php
$param1 = ".";
$param2 = "a.b.c.d";
$ret = explode($param1, $param2);
```

and consider this is my PHP extension written in C.
```c
zval param1, param2, ret;
// call explode with the same way as above
// and ret get return value of explode
// how to do this?
```

How can I do that in C?
Any reference?
Thanks in advance.
 
cmb
 
Thanks, @cmb I will check it up.
 
3:19 PM
my compilation built a PHP installation :D
...now to break stuff...
 
hammer.so
 
I get a 403
 
someone actually made one? I thought it was a photoshop...
 
3:27 PM
Backstory: I'm a developer at the Wikimedia Foundation. I write PHP there. In fact, I've been a professional PHP developer for about a decade. I'm also a metalworker.

Recently, a guy named Eevee wrote a wonderful essay about exactly what is wrong with PHP. It mentions a rather special hammer. I loved it so much, I made one.
 
haha, brilliant
 
Thanks @cmb, I got it works substr("abcdef", 3);
https://gist.github.com/ammarfaizi2/fee3727fb24501a57e5c7df72ab142d0
 
You really ought to not post large blogs of code here... please use a pastebin, that also keeps alignment
 
I apologize, just edited it.
Btw, do I need to free the char *error?
(from the above code I sent).
Let me check it with valgrind.
Valgrind doesn't seem to be helpful, is there a specific procedure to debug PHP extension with Valgrind?
==12587==
==12587== More than 100 errors detected.  Subsequent errors
==12587== will still be recorded, but in less detail than before.
 
Now we know where all those donations to wikipedia go, a forge for producing PHP hammers :P
How's the PHP logo put on it though, etched?
 
3:41 PM
@AmmarFaizi Not really, except that you want to export "export USE_ZEND_ALLOC=0", and some extensions (openssl) reads lots of weird memory stuff
 
cmb
@AmmarFaizi yes, error has to be efree()'d by caller.
 
Now I see, thanks @Derick @cmb
 
 
2 hours later…
5:39 PM
@cmb Are you just kidding with the integer properties? :D It is just for internal classes, right?
 
 
1 hour later…
6:57 PM
@MátéKocsis 3v4l.org/KmsuX
I need to document this in the RFC as BC, people shouldn't be calling __set and __get, but we never know
 
7:11 PM
It's much the same as public __construct, all the magic methods should probably be protected somehow
Hey @NikiC as I see you popping in, I wanted to ask what you thought of the respective PHP namespace proposals that are being discussed right now. We often use your tokenizer as an example, but is \PHP\Tokenizer\Token something you would be comfortable with if such an RFC were to pass?
 
@MarkR Yes, but it's pretty much the only valid use case a PHP namespace would have
The only other use-case is \PHP\Parser\AstNode or so
Anything else does not belong in such a namespace, and as such the concept is not worth discussing
 
You would exclude the soon-to-pass attributes from that? It was what originally prompted the recent discussion
 
Definitely
 
Interesting.
 
7:22 PM
I think what you really want is a proposal that allows the use of namespaces in core / bundled extensions, where an appropriate namespace gets picked
Sticking everything into a PHP namespace is just stupid
 
What would you consider appropriate? \PHP would seem to be naturally equivalent to .NETs System or C++'s std::
 
E.g. when the sodium extension was bundled, we actually changed that from using a Sodium\ namespace into a sodium_ prefix. That's also stupid. That should have continued using sodium\. But making it PHP\Sodium is even more stupid.
 
And Extension\Sodium?
 
Not better
 
Anyone know what this format is called? it is like json but missing punctuation and not valid. Trying to parse in php
 
7:27 PM
If every extension / internal feature were to have its own namespace in root, each addition would stand to conflict with userland code. Which would change it from ... Using the root namespace isn't safe, to using any namespace isn't safe.
 
8:19 PM
@GabrielCaruso omg 😮 i wouldn't be afraid of the bc impact, this is the last time for a long while when we can fix bs like this. Also, i would say that it's not a big problem to break BC in code like that.
 
@MátéKocsis I like your optimism.
 
@MarkR Picking a namespace is always unsafe, technically. It just solves the problem well enough in practice.
 
@LeviMorrison I don't like the idea of the main src and internals maintained extensions showing such disregard for userland. The logical solution arrived upon by the majority of mainstream languages is to namespace or package them under a root.
 
"each addition would stand to conflict with userland code". It's not obvious that would be a bad thing. People would still be able to choose the appropriate namespace and the vast majority of php projects have top level namespaces that are unlikely to clash with one's internals would be unlikely to use.

And there are cases where we would want to deliberately choose a 'clashing' namespace. E.g. for code where a userland polyfill was possible.
 
@MarkR From a technical perspective, we already own the root namespace.
 
8:32 PM
"showing such disregard for userland." - that's a presumption of something.
 
@Danack In regards to the latter point, that is why I expressly stated that \PHP should be limited to things which fit with existing autoloading capabilities. I expect there'll be a fair chunk-o-pollyfil over the next say, 20 years
 
My opinion is firmly rooted that `PHP\` should not be used for extensions. We know from our 2 decades of experience that extensions come and go. Extensions should also probably be written out of core before they ever get bundled, and changing names once bundled should be forbidden, probably.
 
I'll update the RFC with Union Types, I don't want to break these fundamentals methods. Tomorrow morning I'll update the document and internals
 
I'd be fine with reserving \Ext if it came to it.
 
1 hour ago, by NikiC
Not better
 
8:34 PM
\ext doesn't really fix naming conflicts in general either.
 
@GabrielCaruso Seems good! I've also realized in the meanwhile that you wouldn't break these use cases. :)
 
At some point projects have to pick a name and collisions do occasionally happen (happened to me with Ardent), but it's pretty rare.
 
Saying "not better" isn't making an argument, it's making a statement without supporting evidence.
The reality is that we're trying to eliminate resources from the language, as well as adding a bunch of extra internal functionality. Over time we will get collisions, so rather than fake namespaces with Php prefixes, why not use the real thing and solve the problem now, rather than kick ourselves for it in 2030 as is the traditional PHP way?
 
@Danack ;) It was a false alarm :) Nothing will break :( (except for methods with incompatible signature)
 
@cmb or @NikiC I can't push using my id_ed25519 key to git.php.net -- I know others have reported this, but it's been like this for a while. Could one of you merge in my lowercase-hash PR?
@MarkR The .NET example is not the same, btw.
There is no language ".NET".
 
8:41 PM
Jun 6 '15 at 22:09, by Danack
For the record, this is why I do not think anyone should copy anything Enterprise level Java programmers have done. They've clearly, as group gone collectively insane.
Jul 14 '16 at 19:02, by Danack
They are nuts. Seriously, I consider some groups of programmers to have gone collectively insane, and you should do the opposite of what they do, even if you're not 100% sure why you should do the opposite.
 
@LeviMorrison There is the .NET framework however, i.e. the bit which binds the various languages together.
So far in the month this recent discussion has been doing on, the only actual argument that has been made is "But extensions can be moved out of core" ... fine, use \Ext for them.
 
But what does sticking them in \ext even do? it can still conflict.
 
@MarkR you have multiple people telling you the same thing, that they don't agree that it's a problem that needs solving. At some point you might want to consider the small chance that you're missing why they say that.
 
Also, it kind of implies that if I develop an extension out of core (say, php-ds) that when it gets moved into core it should be in \ext\ds now?
I get that you want namespacing so if someone adds array_foo to the language it's not going to break array_foo that already exist, and similar such things.
 
@LeviMorrison We were actually chatting about that a few days ago, if PHP gets generics and such, and has its own set of in-built classes similar to Ds (or even borgs Ds) it would likely be best in \PHP\Collections ... removing it, would be like removing array... it would just be illogical
I'm not overly concerned about userland Levi, but when we've been forced into prefixing our new classes as PhpThis and PhpThat it should be pretty clear that an issue is developing.
 
8:53 PM
PHP\Token is fine by me. Nothing more needed, imo.
I realize that some folks are like "but that's now how everything else is"
PHP\Token and PHP\Annotation deal with language integrated things, specifically syntactical things. They make sense in a PHP namespace.
 
My issue with PHP\Token is it ignores the inevitable that there may be other things eventually called Token in PHP... part of scalar object strings, perhaps. When you create a new project in userland you don't just call your namespace \Thing then put every single class in it. You separate it out into \Thing\Subthing etc
 
@MarkR But PHP owns the namespace -- we can sort it out.
And actually, you are wrong on that Subthing thing.
Many, many organizations put the majority of their code into \Orgname. No sub namespaces needed.
 
You'll have to explain why because I can easily pop over to packagist and give a few hundred thousand examples of it being right.
 
Yeah, you don't see organization's code on packagist, mate.
There's probably even a well established term for the culture of not having deep namespaces.
 
Ignorance and not knowing better?
 
8:58 PM
No, the point is if your organization owns the namespace then it has the autonomy of managing it.
The whole point of namespacing is to not conflict with other people's code. If you own the namespace, you are only conflicting with yourself.
OF course if the org gets big enough, has different products, etc, then it may subnamespace it so each team gets autonomy.
 
I own my car, i'd still be pretty dumb if I ignored best practices and took the seats out and put them back in facing the opposite direction :|
 
I don't know why you made such a parallel -- they aren't remotely close to the same thing.
 
So, in said companies that use a single namespace, presumably because they don't know better... how do they resolve name conflicts, by prefixing all their stuff no doubt?
 
@MarkR They don't have conflicts. Who would they conflict with?
 
Themselves. Almost any project that grows beyond something small is going to end up with name collisions.
 
9:03 PM
4 mins ago, by Levi Morrison
OF course if the org gets big enough, has different products, etc, then it may subnamespace it so each team gets autonomy.
But it's a may.
There is certainly something to be said for having unambiguous terms for things across the entire organization, whether we are talking about code or product or policy or anything else.
If you have 2 terms that mean different things within the org it's just confusing.
 
I more frequently run in to the problem where the same general word means multiple things.
I'm currently managing about 3000 PHP files. I'd bet at least 150 of them are repositories, probably 40 different kind of packages etc
 
@LeviMorrison patch is hard to read with the _fcall change, please merge ahoy ;)
 
cmb
9:21 PM
@MátéKocsis nope, not kidding, but I forgot that this is actually a thing of the past, thanks to wiki.php.net/rfc/convert_numeric_keys_in_object_array_casts
 
 
1 hour later…
10:23 PM
// pass by-value, copy-on-write
$inventory = dict<string, int>[
        "apples" => 134,
        "oranges" => 63,
];
3 new features in one go! One can dream.
 
10:38 PM
Talking of dreaming, following the recent discussions about ojbects + classes, I added some notes on how 'structs' could be different from classes, that might make them worth doing: github.com/Danack/RfcCodex/blob/master/…
 
immutable by default is... bold. I've still not heard anyone come down firm on where the CoW flag would be though
I assume in your examples it's at class entry level?
 
@Danack if mixed type passes, I imagine mandatory typing could be something too
 
 
1 hour later…

« first day (3480 days earlier)      last day (1467 days later) »