« first day (4487 days earlier)      last day (455 days later) » 

12:00 AM
No, it will just be me 99 % @ramsey
 
@Jerm. then, you can use a PHP config file that returns an array, like I showed earlier, and then, to @Tiffany's point about storing secrets in environment variables, I would recommend something like this to handle env vars: packagist.org/packages/vlucas/phpdotenv
 
Thank you @ramsey I will do that
 
If you use that to load env vars from a local .env file (in dev) and you configure your production environment with the proper environment variables, then you can set up your config file to do something like: <?php return ['my_secret' => $_ENV['API_KEY']];
and then your repository doesn't have any secrets stored in it!
 
:)
 
@Trowski Where in that example are we closing the channel?
 
12:07 AM
@ramsey When the task is cancelled or when the run() method returns, the channel will be closed.
Task may be a bit clunky for this purpose, you could instead use ProcessContext, also in amphp/parallel. Rather than writing a Task class, you write a PHP file which returns a function which is provided a Channel object.
 
@ramsey Yes, that. Also see process.php, which spawns a child process running blocking-process.php.
For the most part you should be able to copy/paste the code you've written.
 
12:38 AM
@Trowski Got it working with this. I left out "sending" anything to the context, so let me know if that's okay. I did notice, though, that when I hit Ctrl+C to stop it, it printed out the correct log message, but then I got a segmentation fault. gist.github.com/ramsey/c76cbd243f1d73b9efcbc7702701946a
 
@ramsey Looks great. There's no reason to wait to start listening for messages, that was just for the example. The segfault is potentially related to using fibers in generators, which should be fixed on the next minor: github.com/php/php-src/pull/10462
 
nice!
I'll actually do a local build of that this weekend to see if it fixes it
 
Cool, keep me posted.
 
@Trowski Thanks for your help!
 
@ramsey Not a problem! Happy that Amp seems to have worked for you.
 
 
10 hours later…
10:30 AM
@TimWolla I.....uh, went and read the manual. "The special exit code 125 should be used when the current source code cannot be tested. " apparently.
 
Hey, anyone would recommend a library for easy/intuitive PHP code generation?
At one point I remember using one with a fluent interface ($class->uses(SomeTrait::class)->symbol((new Property())->...)...), but I can't find it anymore.
I think I'll go for github.com/ajthinking/archetype...seems to be what I need, thanks anyway.
 
 
1 hour later…
11:46 AM
@Danack Yes. With 'git bisect run' you need needing automated good|bad testing, though. You can't just automate skipping with that.
 
It looks like you can, with that exit code.
 
But any other exit code will also tell git that the version is good or bad. I wasn't sure if that is desired in your case (i.e. whether you can tell that programmatically).
You specifically asked for automating the skip in the initial question.
 
yes? And the way to do that is use the exit code 125. Or at least appears to be.
0 = good, 125 = skip, anything else = bad.
 
I'm not sure how to rephrase what I intended to say.
You didn't clarify whether the 'git bisect good' or 'git bisect bad' can be automated as well or if that requires that a human brain makes the judgement.
Personally I don't believe I've ever used git bisect run, yet, because it often required me to perform some manual tests for verification.
So using that subcommand for automated skipping of broken revisions would not be applicable.
 
 
5 hours later…
4:25 PM
@nielsdos what static analysis tool are you using? Might make sense to have it run on nightly (or weekly if too long). As something like 2 years ago I tried to get PVS Studio to run and couldn't get any useful results out of it (so many false positives)
 
@Girgias I've mainly run PVS, stack (quite an old academic tool at this point), and I also ran my own tool I develop for my day job. I also tried Clang&GCC static analyser, but those give waaaay to many false positives to be useful.
@Girgias PVS has quite some false positives indeed... Some common false positives of PVS include not being able to deal with PHP's argument handling, and some other macros. So I just filter those out with a grep. That gets rid of alot of false positives although still quite a lot remain.
 
Huh, interesting. SO you are doing a bunch of filtering :D
 
@Girgias Yeah, at this point I sifted through a couple of hundred reports
manually I mean, after filtering
What we can do is create a "baseline". So issues which are in the baseline are ignored and only new ones reported by a potential CI run should be inspected. They can then either be added in the baseline if they're false positive or fixed if they're true positive.
 
Impressive, but much appreciated :) I know I found a bunch of bugs when I was working on enabling -Wextra, I tried tackling -Wsign-conversions but there are so many which are raised within the engine that starting with extensions is pointless
 
There's also 3 "levels" that PVS can report on: 1, 2 & 3. Level 1 are the issues PVS is most certain about, 2 less certain, and 3 is useless imo :p
@Girgias Yeah I also tried to enable that warning and noticed the same thing :p
 
4:36 PM
@nielsdos Great minds think alike :p I might try and tackle this again at one point as there does seem to be some bugs which are cause by sign conversions :/
 
@Girgias Haha indeed :p And oh, yeah ideally all the warnings should be fixed regardless if it's a bug or not... But that's quite a big effort and probably infeasible
 
Morning o/
 
Good morning
 
4:58 PM
@nielsdos I mean... I did get pretty far in enabling -Wundef, the PR is still somewhere. And I somehow enjoy that kind of work at times
(more than currently not understanding why a flag is not being set when concatenation happens during an assignment)
 
 
2 hours later…
6:47 PM
@Girgias Oh yeah I see the PR
@Girgias Let me guess, for your UTF-8 PR?
 
@nielsdos Yup
 
 
1 hour later…
8:12 PM
@Girgias I took a look at your PR and I know the reason why the "f"."o" doesn't work: the concatenation happens at compile time and the string is later interned here: github.com/php/php-src/blob/master/Zend/zend_string.c#L251-L256 but that code doesn't copy over the utf8 flag (same with similar code patterns in that file)
Don't know yet why "f"."o"."o" doesn't work tho
 
@nielsdos Aha, who would have thought string concat is this complicated in PHP :|
 
@Girgias yeah many many layers
@Girgias oh and the other one is because of the permanent function above the request function
oh no
that one is ugly
 
Right, well thanks :D I'm terrible at debugging stuff, I'll get to this tomorrow or feel free to PR my branch with the fixes
 
"foo" is added first somehow along another codepath and then the string with the utf8 flag is matched with the earlier added string which *doesn't* have the utf8 valid flag...
I'll debug a bit more and if I figure out a fix for both I'll send a PR :p
ahahaha
register_class_ZendTestNS2_Foo registers "foo"
but that string has no "valid utf8 flag"
so the "foo" string is already interned because a class has that name (in lowercase), quite funny
but as far as I understand class names must be valid utf8 by construction anyway
so we can fix it there ig
 
@nielsdos I'm not sure, it needs to be valid UTF-8 as a label can be any byte sequence, so it could possibly be a pair of UTF-16 suggorate code points?
 
8:25 PM
@Girgias TIL. Well we can then instead of "foo" choose another test case I guess. The problem is that we can't add the "valid utf8" flag when adding the literal from the test code, because at that point the interned string table could be immutable...
for example, testing with "f"."x"."o" works with my local patches
it's just unfortunate that "foo" clashes with a class name
but that might be okay as in real world code that would be uncommon
 
I think that's the quick solution for this test, will need to add an explanatory comment
But double checking my assumption about the class name is probably wise (and if not create a test)
 
Just checked it, class names can indeed contain a pair of surrogates
So I guess amend test and comment it is, for now at least
I'll clean my patch and PR everything up
 
Thank you!
 
my pleasure, was quite fun and challenging figuring this out :p
 
8:46 PM
PR made :)
 

« first day (4487 days earlier)      last day (455 days later) »