« first day (3201 days earlier)      last day (1754 days later) » 

2:41 AM
I can't test this myself right now because of reasons - but I was wondering...
Can I add a splat operator as a paramter to a function, then a optional paramter of another type?
Example:
interface CarInterface {
    public function __construct( Module ...$module, $args=[] );
}
And then have:

public function Sedan implements CarInterface {
    public function (ChassiModule, $chassi, ElectronicsModule $electronics, $args) {

    }
}
The question being, does PHP knows when the Splat operator ends?
$sedan = new Sedan(new ChassiModule, new ElectronicsModule, $args);
Fatal error: Only the last parameter can be variadic
No can do.
 
@LucasBustamante How could it?
There'd be no reasonable way of determining that.
 
Yes, indeed.
 
@LucasBustamante The more sane approach to what you're trying to do would be to combine the Module with its arguments into a single class.
You probably want a factory pattern, realistically.
 
2:57 AM
Yes. This is for a Builder pattern
In real life, I have a BuilderInterface
But I'm finding a little difficult to interface the constructor
Now that we are talking, I wonder if a BuilderConfiguration class would be a good type-hint for the constructor...
 
class ModuleBuilder {
    public function __construct(Module $mod, $args) {
        /* ... */
    }
}
Then you can simply pass ModuleBuilder directly to the Car interface.
interface CarInterface {
    public function __construct( ModuleBuilder ...$moduleBuilds);
}
That's how I'd do it.
 
yomin
 
@JoeWatkins You look like a pimp with that fedora and those glasses.
 
that's exactly the look I was going for ...
2
 
@JoeWatkins Ahh, you nailed it then :D
 
3:05 AM
@Sherif even if I could use variadics before other parameters in the interface of the constructor, it still would add another layer of complexity that might just not be worth it
Which is to validate in each instance of Builder implements BuilderInterface that the modules passed to build it are the ones I expect it to have
So perhaps I might just leave the constructor off of the interface
 
@LucasBustamante If only PHP had typed arrays :/
This problem would be easier to solve
@LucasBustamante If you want to do that then it'd be easier to just have an addModule setter (eliminating the need for a variadic function altogether).
it can still be a part of your interface
But truthfully, Liskov Substitution Principle would tell us that what you're trying to do isn't SOLID.
If the interface dictates a Module then realistically, the implementing class cannot reject any subtype of Module.
 
The problem is the quantity
Can be 1 or more modules
And I didn't want to limit the constructor of the builder of any other argument
For instance, if you want to pass the Modules and a $args array to further configure the object you just created
But... It's more than that, actually
I could indeed typehint __construct(Module ...$module)
but again, I would need a specific Module in a specific Builder, so I would have to check if that is an instance of the module I expect anyway
 
That's the LSP part
 
DatabaseModule && FileSystemModule
 
Makes no sense to create an interface that says I accept Module and then have the implementing class say nope, I don't take Foo even though it's a subtype of Module\
 
3:18 AM
they are both modules, but they are completely different
they are not interchangeable
 
Then your interface makes no sense
 
yes, that's why I was thinking of leaving the constructor off the interface xD
But as you see, it all started with wondering about variadics and other arguments... I found out I couldn't do it without polluting the API, then, I figured, with your help, that variadics isn't very good for this scenario, since it would require further validation in each constructor, which doesn't make sense
so, now, I'm making a more conscient decision about the design
thank you.
 
 
3 hours later…
5:52 AM
morns
 
6:08 AM
 
 
2 hours later…
7:43 AM
mornin
 
7:55 AM
 
get_class_vars/ReflectionClass::getDefaultProperties don't show typed propertie – #78319
whinge British to complain fretfully : whine
 
Morning.
 
 
1 hour later…
9:11 AM
!!rfcs
 
There are no RFCs in voting. Sorry, but we can't have nice things.
 
9:30 AM
\o
 
10:06 AM
@crypticツ Is that a real security breach?
Or did they just "accidentally" the lorem ipsum
 
I still need a ui person ... none of you are making the right noises ...
@PeeHaa you busy ?
 
10:21 AM
Which noises should I be making, exactly?
Squaking noises?
Rumbling noises?
 
noises like "I'm a ui person, what do you need Joe?"
 
aww, but I'm not :(
:p
 
@JoeWatkins you developed ext/ui, so you are a ui person obviously
 
I know how they work, but I'm not good at them, I guess I should have stipulated that I need someone good at ui's ...
 
Can someone explain why certain developers add things like use function array_map, and use function count? Is this just so other developers can see what functions the class is using quickly?
To the top of classes ^
 
@notatroll it's a micro optimization. Normally, PHP will look for a function array_map in the current namespace first, before falling back to the global namespace.
 
Thanks that explains it.
What exactly are the benifits?
 
what @Danack just said
 
@notatroll "micro optimization" - that describes it to the best of my ability....
"small go faster thing"?
 
that doesn't explain the benefits, it just explains things go faster, what exactly goes faster?
 
10:41 AM
> Normally, PHP will look for a function array_map in the current namespace first, before falling back to the global namespace.
 
@notatroll The benefit is that it goes faster
@notatroll You could see that by taking a look at the AST, for example.
 
@notatroll if PHP skips the looking in the current namespace first, that is less code that is run.
 
 
1 hour later…
11:53 AM
@JoeWatkins what for?
 
I need someone to make a demo ui for an extension I'm working on
 
Hello I'm Just new here. Can someone here can review my code? codereview.stackexchange.com/questions/224316/…
 
12:17 PM
@Rubics I would recommend using objects here, rather than key based arrays....they will make managing that type of code be a lot easier (imo) and also allow autocomplete to work in IDEs...
 
@Danack can you expand it?
 
@Rubics Not really (at least without more effort than I have time for)....it's one of those things you need to try to see how it feels different.
except maybe for:
// Check if attendance has next
                    if( isset($attendance[$key+1])
 
I just used key based arrays to get the next element of arrays
 
That is an implementation detail that should be behind a clearly named method e.g. Attendance->hasNext(): bool
 
smells like generators
 
12:27 PM
Seriously....try re-writing it using objects, and see how much clearer the code will become.
 
Morning!
 
@Rubics If you think about it this is better solved if you treat it like a stack problem. We push all timestamps onto the stack. Then we shift one off at a time, figure out what range it belongs to and create a new stack for that specific range. Then it's simple. Each item in that stack alternates between IN and OUT.
Also, you might want to consider using something like DateInterval instead of this strtotime approach as it makes things a bit more modular.
 
@Sherif I think that's not a good idea. I can't shift it off since it is important to know inappropriate timestamps
 
@Rubics Nothing about what I'm suggesting would prevent you from identifying malformed data.
It just simplifies your asymptotic complexity a great deal.
It also reduces your runtime to O(n) rather than O(n ^ 2 * k)
Which is where you're at now.
 
12:52 PM
@Danack I want to know more about with your approach. If only you have time
 
@Rubics Sorry I don't ....but anyway, it's one of those things you need to try yourself to experience it, rather than just being told. If you convert that code to use objects, you'll see how everything separate out to clearer concepts. Though this talk is on the same subject: youtube.com/watch?v=YKXfOYTBaI4
 
1:18 PM
hi
have anyone experience with php imap?
 
@Rubics Look at the simplicity of my approach vs yours: 3v4l.org/PYeai
@Rubics: The use of a different paradigm doesn't actually help you optimize anything, but it may help you maintain things more easily. Regardless of whether you use objects or arrays, your optimization problems are the same.
@Rubics: Sorry, forgot to include the timestamp 3v4l.org/mfL4r
@Rubics: Now realize the power of simplicity... There's only one punch in the $attendanceAggregator (deduction: someone forgot to punch out). Are they late? Simply check the timestamp against the schedule treshhold. No need for all this complexity you've added.
 
@Sherif Thanks for the effort. But I dont think you get the logic. Run my code and run test cases.
 
moin
 
not atm, I am currently hot, tired, hungry and grumpy
I mean I could but it wouldn't be constructive :-P
 
1:39 PM
@Rubics I understand the problem set just fine :) Feel free to tell me what you don't understand about my solution though and I'll be happy to elaborate.
 
1:52 PM
[FR] Function with duplicate doc where one has a typo in Stats extension doc. – #78320
 
anyone here use event sourcing and willing to answer a couple of questions?
 
I am unwilling to answer questions unless the question is "what would you like to drink?"
 
@DaveRandom What would you like to drink?
 
An ice cold pint of something refreshing, maybe Heineken
with a heroin chaser
 
2:08 PM
@DaveRandom Sounds good, fetch me some while you're at it, will you?
 
Heineken or heroin?
 
@DaveRandom Yes.
!!dad
 
I am terrified of elevators, I'm going to start taking steps to avoid them
 
lucky dip
 
2:30 PM
Is there anyone here, who has a time to review my code and help me make it more easier?codereview.stackexchange.com/questions/224316/…
 
2:46 PM
@Rubics .....what I suggested will take a couple of hours. Why not try that first before asking for more people to review it....or at least what feedback are you looking for if you're not going to take the already offered advice?
 
I did. I'll watch your vid later
 
 
3 hours later…
5:44 PM
\o
 
sometimes I feel bad about billing people for stuff, I just billed like £200 for maybe 10mins work, but at the same time I spent hundreds of hours building the thing that enabled me to do it in 10mins
 
@DaveRandom that's why they're paying 200 pounds
you spent the time to learn how to do it in ten minutes
 
if ever you find yourself charging hooker money for things, then like the hooker, it's likely you deserve it ...
2
 
I spent the time turning a fucking nightmare of a SOAP API into sexy-ass syntax sugar
but still, it's essentially free money at this point...
 
5:54 PM
@DaveRandom Funny, my lawyer doesn't seem to mind billing me $200 to talk to me on the phone for 10 minutes.
 
o/
@Sherif yes but I'm not a professional c**t
 
professional c**t / keyboard whore ... what's the difference?
money is money
 
i had this feeling last week as i set the price for a GoogleAnalytics code injection plugin to 2.5k. Because nobody else would do the manual work for putting the ad code in the html for less. So why not?
 
The one thing I can't get back from you is my time. So I like to be compensated for it adequately.
 
@DaveRandom smart, maintain your amateur status so you can compete in the Olympics ...
 
5:59 PM
@Derick Are you aware of any extensions other than xdebug which use zend_throw_exception_hook? /cc @JoeWatkins
 
@JoeWatkins ah yes, the BoJo approach
 
@LeviMorrison tideways uses it
why, what you up too ?
(it's difficult to know for sure, but one might assume that closed source apms are using it also)
 
Improving an open-source APM.
 
Wes
evenings
 
I'm trying to find out if anyone does any sort of hook chaining, since the current API would require the hook to do such a thing. Only open source usage I've found is xdebug, which does no such thing.
 
6:09 PM
well xdebug isn't the best example of how to use zend hooks really, it does some not very nice things from an ext devs point of view, like setting all opcode handlers without forwarding to previously set handlers ... not really surprising it doesn't forward that hook either ...
by convention, you should chain any zend hook you set ...
 
Figured, which is why I went looking.
 
6:30 PM
@DaveRandom You aren't paid for 10 minutes of work
You're paid for being able to do the work in 10 minutes.
Where's the commit strip comic about this?
 
also you have to add up all the extra costs you have. The whole process to fee someone 200$ is a lot.
and all the emails you wrote.
 
6:57 PM
@JoeWatkins They don't appear to call the previous hook either.
 
you still should, or you shouldn't if your action is terminal ... but probably you should ...
 
@NikiC I got around 70 failures with asan on PHP 7.4 branch -- is that expected?
Ah wait, it somehow ran tests for extensions I didn't build.
 
@LeviMorrison should be clean under asan
 
I apparently have a lot of failed tests because open_basedir restrictions.
 
7:12 PM
@LeviMorrison run-tests should disable open_basedir
 
How do you invoke it? I'm doing an out of tree build, btw.
From a container, this particular one is Debian 10.
 
@LeviMorrison not sure what you mean. Are you using make test right now? That also uses run-tests and should disable open_basedir
 
I'm calling run-tests.php:
PATH="$PWD/sapi/cli:$PATH" $srcdir/run-tests.php --asan $srcdir
 
Looks fine. What errors do you get?
 
# cat /usr/src/php/7.4/tests/security/open_basedir_is_writable.out
Warning: require_once(): open_basedir restriction in effect. File(/usr/src/php/7.4/tests/security/open_basedir.inc) is not within the allowed path(s): (.) in /usr/src/php/7.4/tests/security/open_basedir_is_writable.php on line 2

Warning: require_once(/usr/src/php/7.4/tests/security/open_basedir.inc): failed to open stream: Operation not permitted in /usr/src/php/7.4/tests/security/open_basedir_is_writable.php on line 2

Fatal error: require_once(): Failed opening required 'open_basedir.inc' (include_path='.:') in /usr/src/p
I think it may have to do with out-of-tree builds, since it looks like a relative path is used instead of absolute.
 
7:19 PM
yeah
I didn't even know that we had out of tree builds
 
It seems to mostly work, anyway.
 
7:31 PM
good morning
 
7:43 PM
o/
 
Integer overflow in mb_strpos allows to bypass security related checks – #78322
 
8:20 PM
004+ Direct leak of 24 byte(s) in 1 object(s) allocated from:
005+ #0 0x7f5c579a4330 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
006+ #1 0x55ffcdfe377a in zend_register_functions /usr/src/php/7.4/Zend/zend_API.c:2286
007+ #2 0x55ffcdfe768c in do_register_internal_class /usr/src/php/7.4/Zend/zend_API.c:2686
008+ #3 0x55ffcdfe7b0c in zend_register_internal_class /usr/src/php/7.4/Zend/zend_API.c:2735
009+ #4 0x55ffce06932e in zend_register_weakref_ce /usr/src/php/7.4/Zend/zend_weakrefs.c:194
I get this leak in sapi/cgi/tests/003.phpt and a similar one in 008, maybe the same (haven't drilled down yet).
 
 
1 hour later…
10:03 PM
Does anyone know the solution?
 
Morngins
 
10:33 PM
Evening
 
Heya sir statik
 
10:54 PM
@PeeHaa almost 2am there?
really early morning for you :P
 
@Tiffany Yeah
And nope
 
gone to sleep yet?
 
Just came back from a couple days away and trying to recover from sun burns :D
 
oh, I had a language question for you... not sure if you'd be able to answer
 
I am sitting here waiting for the aftersun to go away :P
 
10:55 PM
...I heard it in a TV show and google wasn't much help
 
@Tiffany Feel free to try me
 
the word was "bitenuker" but pronounced like "bet nyuker" (at least that's what subtitles said), and apparently offensive to Dutch or French
 
heh
 
oh, I guess I should've looked up bitenuker instead of bet nyuker
nevermind, I figured it out
 
Not sure about the bite part, but indeed "neuker" means fucker in dutch
 
lol
Also what the fuck kind of shows do you watch? :D
 
been watching 30 Rock
I should've watched it sooner, it's pretty funny
 
I cannot stand comedies
*most of them anyway
 
D:
I know I tried watching it in the past once or twice and couldn't get into it, but I had the expectation that the female lead would be similar to Leslie Knope from Parks and Rec, and was disappointed. Going in without any expectations has been better.
@PeeHaa a bit fascinating to me: I like drama shows, but I can only handle them in small amounts. Too much serious stuff and I need to watch something light-hearted and/or funny. It affects my mood too much.
 
Yeah I can totally handle all the bad / serious shit
 
11:03 PM
@PeeHaa was trying to find an example of the show, found one of my favorite scenes: youtube.com/watch?v=Guc8EAdXwOI
 
yep. meh
:)
Maybe I am born too close to Germany and have no humor :-)
 
shrug, different strokes :P
or your sense of humor is in a different range
 
Yeah mostly black as my coffee
 
also I think I inherited my mom's sense of humor which was to laugh at almost everything
 
:P
 
11:09 PM
Kind of funny story: she had a tumor in her skull, and the surgeon who was going to remove it commented about her sense of humor, especially in regards to her disease and how much it affected her. I sat in on one of the appointments, and he joked how "it was passed on to her children." I think he called it the "giggle factor" or something. "Giggle factor" is something else apparently, the way he talked about it, it was something he made up on the spot... or he could just be referring to it
 
The start of that sentence is also dark as my coffee :P
Oh kinda late, but...
Happy birthday @Ekin!
12
 
@PeeHaa my mom had a disease that caused tumors, and she had surgery approximately every seven years. Yet, no matter how much the disease negatively impacted her life, she was constantly upbeat. So I either inherited that, or learned it.
not the disease, that is... even though it's genetic, I'm fortunate to not have it
 
Well that sounds like a terrible disease
 
it was
en.wikipedia.org/wiki/Von_Hippel%E2%80%93Lindau_disease . (note that in most cases, the disease causes benign tumors, but in rare cases, they can be cancerous, which was the case for my mom 😒 "winning the lottery, twice" she used to joke)
 
:P
/me closes the wiki page after the first few sentences
sentences and images that is
 
11:16 PM
lol, thought you could handle serious stuff? :P
 
I can, but I don't care too much about gross medical stuff
:D
 
I've thought about going into medicine occasionally, but I think that's the only thing that turns me away ... I don't do well with viscera. I wish it wasn't an issue.
 
Not sure about there, but I assume it's mostly the same and it takes years of education to get somewhere nice
 
not necessarily a medical physician, I think I'd enjoy medical research more. But yeah, similar scenario: requires years of study.
 
I think I would be better as a medical test subject instead
 
11:25 PM
I agree
 
:)
 
tbf no-one in this room would make a good test subject, we are all the embodiment of "outlier", I would discard my own data point on pretty much any graph
on the flip side, we all get to go to the pub earlier
 
\o/
/me is finding bed. Night good people and @DaveRandom o/
 
on another subject entirely, at what point does it make sense to give up on a given record? I have a list of documents to upload to a 3rd party, currently I try 15 times and abandon the record however this is overly naive (the remote API had a 12hr outage and a bunch of stuff didn't get uploaded because it exceeded MAX_ATTEMPTS), I'd like to make something more intelligent but I don't even know where to start
atm I'm doing $backOff = 60 * $attempts
(in secs)
that's obviously not good enough, but I don;'t really know where to go with it :-/
ftr the remote API was returning 500s during the outage, non-connectable does not increase $attempts
4xx doesn't either because I'm confident my code is right so client err is treated as server err :-P
@PeeHaa nn x
 
11:56 PM
@DaveRandom Use exponential backoff
 
@Sherif you're not wrong, however I'd like something a little more intelligent than that. To elaborate a bit, I'd like some sort of sanely simple-ish algorithm that will account for the fact that "everything" is failing (i.e. not invalidate stuff due to remote failure) but also won't keep trying bad records forever
 

« first day (3201 days earlier)      last day (1754 days later) »