« first day (3939 days earlier)      last day (992 days later) » 
00:00 - 20:0020:00 - 00:00

12:04 AM
@DaveRandom go and stare at the ceiling....not quite as good as sleep but better than nothing.
 
approx 3 min ago I purchased a packet of long silver rizla
this is definitely my last message x
 
we can be pretty sure it is not ...
 
f*** you.
 
And yet he's proven right again
 
I love @JoeWatkins to the extent that I would take a bullet for him, but also he knows how to bait me so he essentially permantly has the upper hand
I blame/love @Fabor for this dynamic
srsly I am gonna spark a massive J so properly game over, I am putting th computer down and going to bed, actual nn xx
 
12:20 AM
Enjoy your smoke! Goodnight
 
 
1 hour later…
1:30 AM
Why did I even bother replying on Reddit when I'm getting an idiotic reply: reddit.com/r/PHP/comments/osmyj5/nullable_intersection_types/…
 
You can stop that sentence at the word "Reddit".
 
I'm like, dude I'm the RFC author AND I'm doing a degree in mathematics
Fucking hell, I don't think I'm competent at language design, but holy shit most people don't seem to think more than 3s
 
@Girgias oh my, that PR
I feel kinda iffy about the bump to 8.0, only cause I had trouble installing it on WSL2 debian, and I was trying to quickly check something, and the difficulties were throwing annoying wrenches into my plans
Otherwise it's a <3 from me
 
1:50 AM
@Tiffany Well, we could change the name of the Abstract folder and then it should be fine back on 5.3
But do you know the command to generate the docs?
because that would be handy to have somewhere within the PhD docs instead of refering to PEAR and SVN
 
The debian repository kept installing a May 2020 release of 8.0 dev and I didn't want to spend the time remembering how to wget the tarball, untarballing the tarball and remembering how to build PHP myself
@Girgias I updated the local setup doc :D
Do check it out! There's a couple of typos that I need to fix but otherwise it makes sense now
 
Which I can find where? :D
 
Thanks
Well it fails because it can't find a function v()
 
Let me know if it can be improved, if you go through it
 
1:54 AM
@Girgias ?(reddit|idiot) is mathematically equivalent to fuck (you|your shit opinions)
ftr I tried to sleep
 
Going to PC, I'll help dig for it
 
@DaveRandom See I know that, but forget it for some unbeknown reason
Maybe faith in humanity is to blame
 
that, combined with your own humanity
I assume its similar to the way women who give birth seem to be driven to forget what an awful experience it was and then do it again
best pun I got is FOSSytocin
it's late
 
@Tiffany I found it, it just a matter of importing it into the scope
 
functions.php:40?
 
2:04 AM
Yeah I don't know why PHP didn't "find" it
Anyway debugging the rendering
Well it seems to be rendering
 
🤞
 
Yeah so that seems to work
 
2:21 AM
I need to figure out my WSL/debian situation and get the release version of PHP 8
or maybe it's okay?! I did something a few days ago
tiffany@DESKTOP-SE84OC7:/mnt/c/WINDOWS/system32$ php -v
PHP 8.0.8 (cli) (built: Jul  1 2021 16:14:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.8, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.8, Copyright (c), by Zend Technologies
 
Eh should work
Why do I think the test suite is meant to be run with the php-src test runner...
 
working with php-src too much :P (not a bad thing)
 
No no, I'm actually serious
They are phpt test files
 
I probably cannot provide a useful answer, need sleep
and on that note
 
yeah me too
 
 
3 hours later…
5:55 AM
@Sara @GabrielCaruso still no 8.0.9 tag ?
 
6:31 AM
Hello
How are you
I wish you are all fine
 
6:54 AM
@Tiffany I'm about to build php-src, wish me luck!
@AbdulrahmanHatem All good, just wokeup :) planning the day
Is there a docker image for php/ext development ?
 
7:10 AM
Good morning.
 
7:52 AM
\o
 
mornin
 
@Girgias Yeah, I had the same feeling as well. Did you manage to run the tests like this at last?
 
8:33 AM
@JoeWatkins So, uopz suppresses memory leaks?
 
@NikiC I think it shouldn't have too any more
 
@JoeWatkins One thing that leaks are the added functions (they are emalloc'ed, while PHP assumes arena allocation)
 
ah, right, they were arena allocated last night ...
UOPZ_REPORT_MEMLEAKS=1
there are a few other leaks still
feel free to tackle any of them, and thanks for helping
 
8:52 AM
Anyone has an example of building an extension in github actions ?
 
9:04 AM
@RemiCollet I can tag it this afternoon in case Sara doesn't. Is it just tagging, or is there something else that needs to be done?
 
@GabrielCaruso thanks, please don't forget the revert asked by @cmb
 
@RemiCollet I'll catch up with email during lunch
 
(of course, tag, tarball, and later announcement.... so full release process)
 
@RemiCollet Was asking more in terms of security patches or, in this case, any revert
 
so security patch this cycle, only the revert (mail "Revert fix for bug #79908 from release branches" sent on July 20th)
 
9:08 AM
Amazing, thanks! As soon as I have the time I'll start tagging and let you know! I hope everything is okay with Sara🤞
 
/me hopes so
 
9:58 AM
Should I still announce today?
@OmarS. I saw you asked for solr to be added to Travis... I would strongly suggest you convert to GHA instead. Travis is going to be on the way out.
 
@JoeWatkins When uopz_set_mock is called, is the mock class supposed to exist?
uopz_set_mock(Foo::class, Bar::class); new Foo; crashes right now, but I'm not sure at which point it's supposed to error -- when calling the function or when instantiating?
 
@Derick sounds, good. I'll read up about it
 
If it's for an extension, feel free to copy what Xdebug does (and you can probably simplify it a little): github.com/xdebug/xdebug/blob/master/.github/workflows/…
but i guess you need to test against a real solr server too
 
@NikiC the latter
 
Morning
 
10:22 AM
Morning Tiffany :-)
 
@JoeWatkins Like this? github.com/krakjoe/uopz/commit/… The behavior seems kinda odd
 
@NikiC yeah but bc, it might be that someone includes some file that includes a bunch of uopz_set_mock calls but doesn't actually have the classes loaded yet, the uopz_set_mock and unset mock specifically accept zend_string* not zend_class_entry* ... it would be better to load the class on set call, but I don't want to break test suites ...
the error message from uopz_set_mock is misleading
 
10:38 AM
https://3v4l.org/ZDCCM

Please tell me more
haha wth
Morning guys
 
The true from 6 > 3 is type-casted to int which enables the next operation to work
 
First case should be type juggled
 
10:55 AM
@JoeWatkins ugh why the F**** does uopz disable exit by default???
This completely breaks SKIPIF
 
11:07 AM
At least can work around with -d uopz.exit=1...
 
11:20 AM
@ln-s iirc numbers didn't and don't have the same behavior that strings do
 
mornings
 
o/
Thought it was a simple case of type juggling
 
@NikiC history, uopz existed at first to replace a helper extension for phpunit whose main job was to disable exit by default ... and then bc ...
 
11:42 AM
Morning all o/
 
12:16 PM
morning!
 
12:31 PM
mogoiorng
 
Thanks, it helps a lot!

Yes, still need to figure out how to spin up another container with solr
 
12:46 PM
@PeeHaa Rough night?
 
Does anyone know what PHPStan is wanting here phpstan.org/r/d30f0748-5fdc-4240-a0c8-7c83a4b610a2 ?
 
Though I have no idea what that generic parameter is supposed to mean
 
session_start block echo from method POST using Fetch js ・ Session related ・ #81307
 
1:04 PM
@NikiC T is class type basically … seems like PHPStan has no concept of default template type?
 
@bwoebi But what's the point?
Is this for cases what you know that you only create ReflectionClass for classes implementing a certain interface?
 
@bwoebi I think it's saying that it wants to know what type calling ->newInstance will create.
 
yes and yes
 
which seems a little bit overkill, as it should default to 'object'.....so I turned the error off for now.
> checkGenericClassInNonGenericObjectType: false
 
1:07 PM
@StatikStasis Not Friday yet and have a loooooooooooong call with Amazon :(
 
@cmb @RemiCollet PHP 8.0.9 tagged. Would you help me by updating the submodule at github.com/php/web-php before announcing it in the mailing list and site? That part is not working locally for me :(
 
@GabrielCaruso thanks, will take care of the submodule shortly
 
@PeeHaa =/
 
@GabrielCaruso web-php should be ok now
 
@RemiCollet Thanks. I'm preparing the announcements locally. Are you running QA, or should we be good to go?
 
1:14 PM
@CanVural thanks. Seems I also needed to upgrade from 0.12.67 -> 0.12.93 to make that work locally for me.
 
@GabrielCaruso usually we wait for Windows build, ping @cmb
and yes, I'm running some QA builds (but this is not a mandatory step)
can be strange to announce it, if windows binary are not yet available
IIRC there is something for this in the release file, but usually not needed
 
@CanVural but also ugh.....that fix fixes it for the particular function, but then it infects the functions that call that function, and PHPStan wants more changes elsewhere...
 
@Danack At least with the second snippet, it shouldn't complain about calling that function. Like here it is fine: phpstan.org/r/d5f5601f-4e9d-492a-998c-6f2a2c33d5cb
 
Line   Params/functions.php
 ------ -----------------------------------------------------------------------------------------------------------------------------------------------
  674    Type mixed in generic type ReflectionClass<mixed> in PHPDoc tag @return is not subtype of template type T of object of class ReflectionClass.
  687    Function Params\getReflectionClassOfAttribute() should return ReflectionClass<T> but returns ReflectionClass<object>.
  706    Unable to resolve the template type T in call to function Params\getReflectionClassOfAttribute
The code is covered in tests.....and the reflection is for any class, so PHPStan isn't providing much value here, so I'm just going to turn that off.
 
1:31 PM
Yeah. I also think it doesn't add much value in this case.
 
@MateKocsis I didn't get there yet... went to bed, but the PHPT test format ticked me off that that's probably the test-runner, so I'll try it soonish
 
I would open an issue about how it should default to ReflectionClass<object> and then error elsewhere....but as there are already 488 open issues, the project probably doesn't need any more.
 
Is there a special options to enable caching_sha2_password when compiling mysqlnd? All I get is Loaded plugins => mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password
 
1:45 PM
@RemiCollet yeap, indeed, I'll wait. commits are ready locally, before the end of the day I'll check here to see if they are available and we can announce stuff
 
@Dharman requires ssl support
 
Ohh right
thanks
 
@Girgias I tried it in the meanwhile, and it was missing the required files in the tests: include/PhDReader.class.php, include/PhDFormat.class.php, formats/xhtml.php. Crazy...
 
Ah so the Autoloader wasn't working nice
 
cmb
@RemiCollet I've just started the builds /cc @GabrielCaruso; takes about an hour or so; will upload then, and run tests
 
1:59 PM
@cmb Super, thanks for the help!
 
Now this is a cute trick, and one I may actually leave in the comments instead of deleting: php.net/manual/en/function.array-map.php#84632
 
@Girgias yeah, so do I suppose that it's and autoloader issue, since there are no such files. On the other hand, both phpdotnet\PhD\Reader.php and phpdotnet\PhD\Format.php exist.
 
@Crell How about ... a closure?
 
I didn't say it was the best solution, just that it was a cute trick. :-) I have no idea which would be more performant.
 
2:16 PM
@Dharman fyi you can ignore Andrey Hristov
 
What is he doing?
 
cmb
@Crell still, in the end all notes should be removed; in case of a useful trick, consider to put it into the manual proper
 
That's largely what I'm doing. :-) I occasionally leave something in comments if I think it's interesting but wouldn't really make sense in the page proper. Still I delete about 90% of comments on a page.
 
cmb
ah, fine then :) and thanks!
 
Ohh I see, there's some list I am not part of
 
cmb
2:21 PM
the replies should have been sent to you as well :)
 
@Dharman Well, then you have even more reason to ignore him :)
 
I maybe should rebase that MySQLnd PR I made like 1y ago...
 
@Girgias Maybe it got forgotten... what was it about?
 
@Dharman It wasn't forgotten: github.com/php/php-src/pull/5586
 
I can never remember... "As of PHP 7.4" or "Since PHP 7.4"?
 
2:33 PM
I like since tbh
 
There's one that is the manual standard; I can just never remember which it is.
 
Henceforth 7.4
 
@Girgias I don't know about this PR. If anything I would remove the whole functionality for memory tracking from mysqlnd. But on the other hand, I don't know if there's a good enough reason to drop it. There might be people who use it. I don't know what anyone would use it for, but it is exposed through mysqli. I wouldn't mind removing all debug and statistics from mysqlnd as I don't really see use for it. I'd rather prefer to set up debugger properly and use that then the macro debugging.
I also doubt that the statistics report correct information.
 
I think I've seen more "As of PHP 7.x" than since
 
@cmb Present for you: github.com/php/doc-en/pull/828
 
2:40 PM
@Crell Please use "as of"
 
Oh good, that's what I used.
 
Has the doc policy changed on type hints?
Are we allowed to add them now?
 
@Crell Yeah, but generally we specify the full version so 7.4.0
 
cmb
@Crell sorry, I'm not allowed to take presents :p
 
2:42 PM
Silly union policies...
 
cmb
@Dharman right; and we don't care about pre-releases
 
With some of these pages, it feels like I'm the first person to ever try and clean them up. There are comments 17 or 18 years old. I think I saw (and deleted) one that was over 20.
 
Here's the top 11 visited heap.space links since Jan 1st:
/xref/PHP-8.0/Zend/zend_types.h
/xref/web-php/
/xref/PHP-8.0/Zend/zend_compile.h
/xref/php-src/Zend/zend_API.c
/xref/PHP-8.0/Zend/zend_execute.h
/xref/PHP-8.0/Zend/zend.c
/xref/php-src/Zend/zend_alloc.h
/xref/php-src/Zend/zend_API.h
/xref/PHP-8.0/Zend/zend_API.h
/xref/PHP-7.4/main/php_streams.h
/xref/PHP-8.0/Zend/zend_execute_API.c
 
@Ekin surprised that zend_alloc.h is so high, but php-src/zend_types.h missing there
 
Some of these comments are old enough to vote...
 
cmb
2:58 PM
@bwoebi zend_types.h is on top :)
 
@cmb the php 8.0 one, yes
but missing the master (php-src) one
 
oh wait, I had one job... php-src/zend_types.h is actually right after PHP-8.0/Zend/zend_compile.h
 
cmb
lies, damn lies and stats, maybe ;)
 
3:10 PM
@GabrielCaruso Thanks for covering. I was offline all day yesterday and I just effing dropped the ball on Tuesday.
 
I really wish people would remove comments when they updated the body to render the comment no longer necessary. So that I don't make the same mistake...
 
3:32 PM
Glad you are okay, I was worried :(

PHP 8.0.9 released, thanks everyone for your help!
 
\o/
 
woohoo well done Caruso/Sara!
 
@Crell Do you not have your own docs karma?
I mean, I get that you're shy about committing to php-src, but docs should be a no-brainer for you.
 
I... hm. I did before the migration, but I don't seem to have a merge button on GitHub.
And I still don't like pushing direct to the repo without getting others eyes on it first. They almost always find something. :-)
 
Guys any comment how can I write this cleaner?
    if (class_exists($controller)){

        $controller_obj = new $controller;
        if (method_exists($controller_obj, $action)){
            $controller_obj->$action();
        } else {
            throw new ResourceNotFoundException();
        }
    } else {
        throw new ResourceNotFoundException();
    }
 
3:35 PM
@stack you can avoid all "else" statements by throwing sooner rather than later
 
@GabrielCaruso Looks like we did the annoucing at the same time... and I got VCS conflicts :-/ :-)
 
@FlávioHeleno How sooner? I need to check it first and them throw if not exist
 
eg.
```
if (class_exists($controller) === false) {
throw new ResourceNotFoundException();
}
// code follows here..
```
 
@Sara Also, I don't have commit on php-src to begin with.
 
huh.... docs-* access is rolled into the php-src team...
 
3:36 PM
@Derick apologies
 
nah, it happens. Just unfortunate timings
now we can both wait for the site to update :-)
 
@Crell Sure, but my point was you could have doc-en only, without having php-src write access
 
@FlávioHeleno early returns ftw
 
@GabrielCaruso hell yeah <3
 
@Sara Which I thought I did. I did back in svn, but I don't have a GH merge button, so maybe that got lost along the way somehow?
 
3:37 PM
We used to have groups organized like that, but I guess with the rush to move to github we just never recreated that
 
@Crell GH merge button is considered evil
... because it mostly greatly increases spaghetti branches
 
Eh... for docs repo I think it's fine, though GH now as a "rebase and commit" button as well, which is nice.
 
i would like, a: "rebase, commit with merge commit" button, and then we can talk.
 
why tho?
 
like this:

if (class_exists($controller) === false) {
throw new ResourceNotFoundException();
}

$controller_obj = new $controller();
if (method_exists($controller_obj, $action) === false) {
throw new ResourceNotFoundException();
}

$controller_obj->$action();
 
3:40 PM
@Sara Groups commits that belong togetherish, together
 
dear lord I suck at formatting here :-|
 
@FlávioHeleno yes it would the job too
 
@FlávioHeleno No, this chat sucks with formatting.
 
@FlávioHeleno Ctrl + K
 
Mmmm I can see that for multi-commit patchsets, yeah
 
3:40 PM
@FlávioHeleno So does everyone. It's SO's fault.
 
Though they also end up grouped together by virtue of all of them being rebased to the tip.
 
they (SO) could throw some love in this :-(
 
@Sara Right now I have that quite a bit for Xdebug - add feature in one commit, then another commit to fix things because Nikita broke something again ;-)
@Sara It's not as visual though, when you look at things with tig or gitg
 
@Derick For sure.
 
fpm does not starts pool when ENV is more 8000 bytes ・ FPM related ・ #81308
 
4:19 PM
@Sara I think it requires being added to the PHP GitHub organization, then given access to doc-en. When GitHub became the canonical source, Nikita sent an email stating if people wanted access to a repo to respond and link their PHP account. Not sure if that's still the process, but should be something along those lines
ah, it was PHP account and github account that was included in the response
 
How exactly do I get from a zend_string* to a smart_str*?
 
@Tiffany Yeah, I know that's the protocol, I was just surprised to find there wasn't a team for just doc.
 
@Sara there is :P it's secret
 
@Crell Short answer: You don't.
 
@Sara Excellent.
 
4:24 PM
@Crell You can start a new smart_str and appendl the original string
 
What exactly is a smart_str?
 
It's a contrivance around doing a shit-load of reallocs to gradually build up a string from component pieces.
 
Ah, so it's "a string like most other languages have"?
 
Not an entirely unfair description.
 
:-)
 
4:25 PM
... I added something like that to Xdebug way before PHP had it :-)
 
Hipster...
 
Just ahead of the curse!
Curve, I mean curve!
 
Sure you did...
 
brb, donating to the RNLI to piss of some racists
 
So, I have an op, that is a value. If it's a string, I want to safely get the first X characters of it to include in an error message. So, vaguely, I need:

* zval_get_string(op) to get a zend_string*
* make new smart_str*
* Add the zend_str* to the smart_str* (somehow?)
* use smart_str_append_escaped() to concat my error text with that string, truncating at some hard-coded point.
use that string in zend_throw_exception_ex().

Am I in the right ballpark?
 
4:31 PM
what are you trying to do?
you shouldn't reallt need to escape anything there
 
cmb
@Crell not sure about escaping, but I think this is already done elsewhere. If so, see phpinternalsbook.com/php7/internal_types/strings/… (no need for smart_str)
 
Yeah, smart_str feels like the wrong end of this
 
I think @IluTov is wrong, the exception mechanism itself truncates
 
I want to show the variable value in the error output, modulo quoting, escaping, and length limiting.
Hm. Let me add a test and see what actually happens right now.
It doesn't appear to be truncating. Or if it is, it's more than 500 characters.
 
4:37 PM
yes, 1024 is the limit
 
Ah. Is that what I should leave it at?
 
as I said... I think the exception mechanism handles that for you
 
@MateKocsis @cmb I'm happy to announce that I managed to run and pass some of the tests in PhD
please see the PSR-4 PR for my magical change
 
const int max_strlen = 100; /* pick your maximum... */
if (ZSTR_LEN(stringified) > max_strlen)) {
    zend_string *trunc = zend_string_init(ZSTR_VAL(stringified), max_strlen, 0);
    zend_string_release(stringified);
    stringified = trunc;
}
Something like that should be sufficient.
Maybe work an ellipsis in there...
 
Although I do think we should not use the php-src test runner, but that's a work for the FUTURE
 
cmb
4:39 PM
@Girgias \o/
 
@Derick That... doesn't seem to be the case. If I have a variable that is "e\n" repeated 2048 times, I get 2048 lines of the letter e in my output.
 
why do you want to see e 2048 times?
 
@cmb The solution for the DB problem, is to do Config::setMemoryIndex(whatever-non-falsy-value);
 
I don't. :-) I'm testing to see what huge-and-messy strings do. And I'm flexible on what we want them to do in this case.
 
But anyway I'm off soonish for a family party so PhD shall wait until tonight...
 
4:41 PM
Still working on your doctorate, eh?
 
I wished
Pretty sure understanding how PhD works is worthy of a PhD thesis...
 
@Sara That seems to work to truncate, once I fixed an extra parens. Should I also try to fiddle with newlines?
And what's a good test for escaping illegal values?
Hm, and I don't see a zend_string_append or zend_string_concat, either...
 
Since recently, GDB doesn't reload source code files when I update code while in a debugging session (or rather, not quitting GDB) - is there any thing I can do to change that back? I know I can run "directory" to force it, but that's not very convenient.
 
@Derick 2GB conspiracy
Off to gym...
 
5:13 PM
@Girgias Oh la la! 🎉
 
Unable to compile because of curl directory structure ・ solr ・ #81309
 
5:24 PM
Well this is exciting.  I have this code now:

const int max_strlen = 10;
if (ZSTR_LEN(stringified) > max_strlen) {
    zend_string *trunc = zend_string_init(ZSTR_VAL(stringified), max_strlen, 0);
    trunc = zend_string_extend(trunc, 3, 0);
    ZSTR_VAL(trunc)[max_strlen] = "...";
    zend_string_release(stringified);
    stringified = trunc;
}
And instead of a ... at the end of the truncated string, I am getting 1.
 
5:38 PM
Clarify UPGRADING entry (bug?) ・ PDO MySQL ・ #81310
 
@Crell Yeah, was just gonna say that is very not right.
Try: char *s = ZSTR_VAL(trunc) + ZSTR_LEN(trunc); s[-3] = s[-2] = s[-1] = '.';
 
:stare:
I still want to know where the 1 came from, even if it's wrong. :-)
 
The '1' came... honestly, from chance. ZSTR_VAL(trunc)[max_strlen] is a single char rval, to which you're assigning a char* pointer. That pointer is.... somewhere determined by compilation and execution, but it's getting truncated down to fit 8 bits.
Wrose though, is that you now don't have a null terminated buffer, so it's running off until it finds one.
 
Yay, security holes!
 
Also, in that line I gave you. You probably need an s[0] = 0; though maybe not, depends what string_extend does.
Yeah, string_extend doesn't implicitly terminate for you.
 
5:44 PM
Hrm. It also is giving me a zend_string* vs char* mismatch.
 
hrmmmmm where?
 
Also, isn't s[0] the first character of the string, not the last?
 
char *s = ZSTR_VAL(trunc) + ZSTR_LEN(trunc);
In this code, s is pointing at the end of the string.
 
wat?
Oh, wait, I see what you're doing. I think.
 
ZSTR_VAL(trunc) is the start of the string. 1 octet forward is the next character, and so on.... by the time you've moved forward LEN characters, you're at the end.
 
5:47 PM
OK, you're mutating trunc in place, not making a new version of it.
 
Then when we emplace a '.' at s[-1], s[-2], and s[-3], that gives us an ellipsis
Right.
trunc already is a new string, wholly owned by us
So we can modify it all we want.
Also, to avoid an extra realloc, we could refactor this to something like:

zend_string *trunc = zend_string_alloc(max_strlen + 3, 0);
char *s = ZSTR_VAL(trunc);
memcpy(s, ZSTR_VAL(stringified), max_strlen);
s[max_strlen] = s[max_strlen + 1] = s[max_strlen + 2] = '.';
s[max_strlen + 3] = 0;
This way, we only ever do the string's buffer alloc once, and only do a single copy of the contents.
But we're also in an error handler here, so I'd go for whatever is more readable and damn the performance
 
Hm, well, now I'm getting an ellipsis and nothing else. So, progress?
zend_string *trunc = zend_string_init(ZSTR_VAL(stringified), max_strlen, 0);
trunc = zend_string_extend(trunc, 3, 0);
char *s = ZSTR_VAL(trunc) + ZSTR_LEN(trunc);
// Overwrite the last 3 characters with .
s[-3] = s[-2] = s[-1] = '.';
s[0] = 0; //Reterminate the string, just to be sure.
zend_string_release(stringified);
stringified = trunc;
So something in there is losing the data in trunc?
 
6:09 PM
Hm, but your second version does work. So... what's the difference?
They both seem to my uneducated eyes like they should do the job...
 
Howdy! I'm trying to select db items using mysqli where the element of one column does not match a regex, but I cannot get it to work, it just returns everything that does match instead. "SELECT Parcel FROM Parcels WHERE Parcel NOT REGEXP '$regex' LIMIT 20000"
 
@Crell zend_string_extend expects the new length, not the amount to extend the length by
 
AH! That would explain it.
 
In fact the code has ZEND_ASSERT(len >= ZSTR_LEN(s));
are you compiling without debug?
 
that looks overly complicated, and contains mistakes
static zend_string *zend_string_truncate_output(zend_string *input, size_t length) {
	if (ZSTR_LEN(input) <= length) {
		return zend_string_copy(input);
	}

	zend_string *output = zend_string_realloc(output, length + 3, 0);

	memcpy(&ZSTR_VAL(output)[length], "...", sizeof("..."));

	return output;
}
 
6:19 PM
@bwoebi I... guess so? I'm just rerunning make test and letting it recompile.
@JoeWatkins I was somewhat surprised that such a function doesn't already exist.
 
there's not really many helper sort of functions, except ones we need, like concat variations, but they don't look useful here ... what you want to do is reallocate the string to make it writable and so there's enough space for "...", then copy "...", and ^ is the most succinct code for what you want to do I think ...
 
So are you suggesting inline it, or add that utility and use it?
Heh, well, inlining it segfaults. Go me...
 
6:38 PM
@ln-s holy excrement of hercules muscular arse, this slaps I love it
 
@Crell I see you're experiencing the joy that is strings in C
Sorry if my review came across overly snarky. It's a nice feature.
 
@IluTov I loathe them. :-) And I didn't read snark, don't worry, just fear that it would get rejected because reasons. (Despite me spending 15 minutes trying to figure out WTF was wrong with my code that was doing essentially match(gettype($foo)) :-) )
@IluTov Any suggestions on a string that I could use to test escaping? Something that would break horribly if it were printed? I already have a newline test and it's fine. A bit ugly but not unsafe.
 
6:53 PM
@Crell Probably multi-byte stuff. E.g. str_repeat('a', {whatever is the limit}) . 'ä'. PHP strings can also contain the NULL terminator. var_dump("\0 hello world"); 3v4l.org/BeSsS#v8.0.8
I'd imagine the latter is handled. But the former probably not.
 
Nullbyte seems to work fine. It just truncates the string at the null byte.
 
@Crell Well it shouldn't :)
 
What should it do?
accented characters seem to behave acceptably.
Ah, no, wait. Not if it's the very last untruncated character.
Fun times. sigh
Is there really no pre-existing "make this variable's value safe to print" function already?
Seems like the sort of thing that would be useful...
 
@Crell The same as printing it to the string in userland. It's just not visible but the rest is printed.
@Crell Yep, that was the point of the str_repeat, to push it back.
 
Oh, I misread your example.
 
7:10 PM
Is there a good place to crib from for dealing with truncating mb strings or null-byted strings?
 
@Crell just don't … at least not in the engine.
 
@Crell Maybe it's also acceptable to simply ignore mb strings here for the sake of simplicity. I'm not sure how others see it.
 
If you want to be a bit nice, you can try truncating after the current utf-8 character by allowing a lookahead of 4 bytes (and check for & 0x80)
 
I have no strong opinion.
 
I was saying use the code I posted, with a sensible name
 
7:20 PM
Hello, everyone can i share an image here showcasing my small problem
 
@Crell Maybe the same goes for NULL termination. Probably not something very common. As long as it can't be exploited which it probably can't.
> Chatroom Don'ts: Ask to ask a question. "I have a problem, can anyone help?!" Please just ask your question and wait patiently for other people to answer.
 
@NikiC grumble grumble ... there's even less to go on in that last trace ...
 
sorry for my bad English! On my website yet no ads are running and loading times are okay but my hosting site is asking me to pay up more to optimize my website for user who are mostly from abroad. is their any way to fix my issue with some open source or free method, here is the image regarding my issue drive.google.com/file/d/13mADxbAPtWyDksh-sa1VHjFFBnC7LhOW/…
 
Segfault running test suite with JIT enabled ・ JIT ・ #81311
 
@AmorLov can you post the image on imgur
Or post it in here, but add text so it doesn't onebox
 
7:34 PM
@AmorLov You need to figure out what it's complaining about. There's a zillion things that could impact performance in various ways, not all of them PHP. Most of them not PHP.
Web page optimization is a beast unto itself.
@IluTov @bwoebi Well, I just pushed what I have so far. Including an inlining of Joe's suggestion.
 
@Tiffany and @Crell thanks please can you tell me how long is it taking for you people to fully load my home page ? my website is giveawaydog it should show up first in google search and yes i have tested the online webpage test tool but it always giving me different numbers sometime even 5 secs and more : / but in my country the website is loading fine/
 
@AmorLov Including all images, a little under 5 sec.
Which seems a bit long for a page that's only a half meg in size, but because the paint starts so quickly it doesn't feel that slow.
The initial request took 680 ms or so, which feels like a long time. That's going to be a combination of PHP time and network latency. So, there probably is some PHP optimization you could do; what, I have no idea. Looks like you're using Wordpress, so you should look into a Wordpress forum.
Your browser's debug tools can tell you far more.
 
what about second load time it should load faster because browser store images in its memory, and thanks for the input, if loading not feel bad then i shouldn't be worried about it. as I am making No money from that website. and I will try removing some plugins hope it can fix my issue. thanks.
 
7:51 PM
@Crell so you did not like my suggestion of using the smart_str_append_escaped code too much?
 
@bwoebi I couldn't figure out how to use it. I got multiple different suggestions from Sara and Joe, and ended up with the shortest.
<-- C newbie still, remember.
 
@Crell i deleted one big plugin from my website and now it is even taking longer to load, lols wordpress make no sense. I give up.
 
00:00 - 20:0020:00 - 00:00

« first day (3939 days earlier)      last day (992 days later) »