« first day (4731 days earlier)      last day (439 days later) » 

01:32
@Jimbus ....oof, it's been awhile since I've worked at a place where people didn't use a version control system
 
3 hours later…
04:11
> A society grows great when elders plant trees in whose shade they'll never sit.
 
4 hours later…
08:40
@Tiffany Meanwhile we have 16 year olds arrested for cutting down famous trees with chainsaws bbc.co.uk/news/uk-england-tyne-66957589 ... so I'd say society ain't looking great
 
2 hours later…
10:27
o/
11:08
o\
11:48
I was investigating a performance issue in a third-party library when encoding data as JSON, and looking at json_encode I found some nice optimisations. However, there's something where I really don't quite understand what it does. Is there somebody here that could explain ZEND_BIT_TEST and specifically its use in php_json_escape_string (see github.com/php/php-src/blob/master/ext/json/…) to me?
@alcaeus My suspicion was that it checks for ASCII characters which do not need special handling and can simply be emitted and the commit taken from git blame seems to confirm this: github.com/php/php-src/commit/…
Though why exactly this works is beyond me as well :-)
@TimWolla yep, that's pretty much how far I got. I could tell what it does, but I don't understand it enough to sanity-check my adapted implementation of the algorithm. In my implementation, the assertion in github.com/php/php-src/blob/… trips, which makes no sense to me...
Anybody have Dmitry's phone number? :D
Ah, it's 8 * 32 bits = 256 bits and each bit probably corresponds to a single byte value.
And the ones where the bit is zero can be emitted straight away. Bits will probably be one for stuff like ", `` and similar.
Yes, I'm guessing for all characters in this list: github.com/php/php-src/blob/…
I removed some cases in that switch since we don't need to escape them, and re-adding them fixes the issue. I still haven't quite figured out how the bit masks play into this and what change this needs.
I tracked the optimisation down to this commit: github.com/php/php-src/commit/…. Now I just have to figure out what Dmitry was thinking 6 years ago. I better do this in silence before I say something stupid.
12:11
@alcaeus It will probably become clearer if you convert the magic numbers into binary representation.
php > printf("%032s%032s%032s%032s", decbin(0xffffffff), decbin(0x500080c4), decbin(0x10000000), decbin(0x00000000));
11111111111111111111111111111111010100000000000010000000110001000001000000000000000000000000000000000000000000000000000000000000
12:34
Ok, now I got it. It took me some time to do the math, but essentially it's reducing all characters and checking in a bitmap to see which ones need escaping
Doing the math "by hand" allowed me to remove the bits for the characters that don't need escaping on our end
Thanks for rubber ducking this with me :)
13:10
@Tiffany My knowledge of modern version control is very basic, so I can't complain too much. Git was a baby and sccs was horrible when last I developed in a professional environment. I really need to spend some quality time with theory and best practices of practical git, because it's becoming apparent that as far as the programming, I am god, here :) (that is I have free reign for the most part)
13:20
I use this "bitfield" technique in Xdebug too, to remember on which lines there is actual code: github.com/xdebug/xdebug/blob/master/src/lib/set.c
It's beautiful, and it's freaking fast. I just wish there were some comments in it that explained what it does, or how those magic numbers are computed.
13:57
@bwoebi Any idea why the Observer API wouldn't trigger for internal functions such as dirname / strrev, but does for things like xdebug_start_trace and uniqid ?
14:37
opcache optimises them away, it seems.
so that means I can't use observer for internal functions. Too bad.
15:01
@Jimbus I highly recommend youtube.com/watch?v=Qf5LYx5l9Qc
also, of course git-scm.com/book/en/v2
@bwoebi Also, I had hoped that I could get rid of my zend_execute_ex override, but I can't, as observers are also not called for script bodies (ie: include, require, eval).
Thanks Tiff, I'm not dumb, I know the value of a safe and sane environment, but I'm realistically drowning in information. Your coaching (and a few others) has been greatly appreciated!
15:18
@bwoebi And Observer is PHP 8.1... and not 8.0 :-/
15:55
@Jimbus FWIW, that's how it was for me when I first joined this room, back in 2016, and hanging out in here more consistently in 2017... there was a lot for me to take in, and there was a lot I wasn't able to apply because of where I was employed, and the expectations of that job... it has taken me several, several years from where I started to get to where I am now
and I'm still just barely above junior
16:47
@Derick These are the ones it converts into specialized opcodes, right?
some of them, I think
I had no problems with zend_execute_internal with them though
 
2 hours later…
19:14
Friday \o/ o/
 
2 hours later…
20:57
I can't build PHP 8.3 with clang 16:
$ make
/bin/bash /usr/local/src/php/libtool --silent --preserve-dup-deps --tag CC --mode=compile clang-16 -Iext/libxml/ -I/usr/local/src/php/ext/libxml/ -I/usr/local/src/php/include -I/usr/local/src/php/main -I/usr/local/src/php -I/usr/local/src/php/ext/date/lib -I/usr/include/libxml2 -I/usr/include/aarch64-linux-gnu -I/usr/include/libpng16 -I/usr/include/freetype2 -I/usr/local/src/php/ext/mbstring/libmbfl -I/usr/local/src/php/ext/mbstring/libmbfl/mbfl -I/usr/include/postgresql -I/usr/include/editline -I/usr/local/src/php/TSRM -I/usr/local/src/php/Zend  -D_GNU_SOURCE  -fno-common -Wall -Wex
It seems clang 16 enabled -Werror=incompatible-function-pointer-types by default.
Guess I'll have a PR or two incoming.
@Derick they are
@Derick yes, it is. Thought xdebug would only support three most recent versions, i.e. starting 8.1 once php 8.3 is released?
@Derick can't you set an optimizer flag preventing this?
I mean, you probably don't want to have sccp in general for xdbeug? I.e. fully disable that opcache step?
21:18
Bother. I don't have the error on clang-16 on Mac, just Linux. Hmm.
@LeviMorrison I'll have a look
Might be also because of a different libxml2 version?
Could be, yeah.
Can't reproduce. It complains on your end about the constness I think.
Probably version related, the typedef in libxml2 was changed long ago: https://github.com/GNOME/libxml2/commit/e03f0a199a67017b2f8052354cf732b2b4cae787
If you're on < 2.9.8 then it probably reproduces?
I'll check with an old libxml2 version
I believe it's using Debian buster's libxml2 which is... v2.9.4.
ofc Debian and it's ancient packages
thanks for the info, I'll build that version locally
yeah reproduces now
21:30
Debian buster goes EOL on 30 Jun 2024, FYI. At least according to endoflife.date/debian.
PR coming soon
@nielsdos Are you going to mitigate, or require libxml2 >= 2.9.8 or whatever?
@LeviMorrison #ifdef ftw
so mitigate
can't bump the requirement now, too late for that
also, if distros still have these old versions we can't easily bump our requirements
At least not until PHP 8.4/9.0. Then this OS will be EOL and we shouldn't care ^_^
RHEL 7 goes into its next EOL phase on the same date. It's a glorious day. I should mark it and celebrate it.
21:39
Thank you ♥️
My only question is: should this be backported to all versions still taking bug fixes? Since clang-16 enables this error by default, it will likely cause problems before these other PHP versions go EOL.
Normally for -W fixes we don't backport, but this one may make sense.
This particular code is only in 8.3 and up, and the PR targets 8.3 so should be fine :-)
I'm taking it in my merge queue for tonight
I have to merge two other PRs too
@LeviMorrison Is that a new Clang 16 warning? Because if yes finally, the only way before to actually flag those was MSVC >_>
@Girgias I imagine the warning existed before, but here: discourse.llvm.org/t/…
So now GCC is the only one that is kinda lax
Welp
22:05
@nielsdos Just opened this one: github.com/php/php-src/pull/12327
Looks fine, but it's Alex's ext so I'll let him judge :)
23:13
@nielsdos you only added methods to hat classes to ext/dom in 8.3 right?
The gen_stub file is a tad annoying with the generation of new methods...
@Girgias wait is this a question to which version, or how should I interpret it
I added properties and methods in 8.3
Props should be covered in github.com/php/doc-en/pull/2812
It was more to ask if yu had added a new class :')
But also to what classes might be useful for me to sort through the generated files
no new classes
Check classes DOMNode, DOMElement, DOMNameSpaceNode
Check interfaces DOMParentNode
thanks for the props, will take a look
23:45
Okay @nielsdos how interested are you in hopping on a call and explain to me how to use DOMDocument so I can generate the XML for the new methods XD
oh boy
It shouldn't be too difficult
I have to be quiet but I can call
Sent you my Discord username on Slack
(or if you have a preference for something else let me know
ait hang on

« first day (4731 days earlier)      last day (439 days later) »