« first day (3393 days earlier)      last day (1552 days later) » 
00:00 - 19:0019:00 - 00:00

7:00 PM
The one to bypass disabled functions?
 
7:16 PM
debug_backtrace() is a kludge
 
yes
 
heh, doesn't work on 3v4l.org apparently he prevents forking
smart
 
whats the reason behind the function anyway? Back in the days socket_open and such things were forbidden on free webspaces but with containerrization going on sandboxing is getting less and less a problem.
and there were workarounds for a lot of "disabled" functions
 
Defence in depth.
 
@user3655829 security is built in layers
You want to have as many obstacles in front of an attack vector as possible wherever possible. The deeper they can penetrate the worse.
It's good thing 3v4l blocks all stream access otherwise I could hit the AWS API remotely and break out of the whole jail they built here
But, yeah, publishing a 0day without warning is just rude
 
7:26 PM
hmm i am partly on the side of the hacker because he maintains the exploit repo since months
 
Not the first time in recent history. A few months ago someone published an NGINX/PHP-FPM exploit as soon as a patch was made, even though there wasn't a release. The exploit ended up being used to attack thousands of sites
 
fwiw we don't consider that security-relevant
If there is no (even hypothetical) pathway to remote exploitation, it's uninteresting
 
@NikiC I'd agree
 
then why not delete the disabled_functions part completly?
 
It's like exploiting those php opcode obfuscators... meh
 
7:29 PM
it doesnt work and for every function there is probably a workaround.
 
@user3655829 Just like open_basedir, disable_functions is about preventing mistakes
It helps to avoid accidents because someone accidentally deployed a CLI script with shell executions to your production environment.
I use disable_functions for fuzzing, for example ;)
 
Any suggestions as to why any PHP process is claiming 200+mb of virtual memory? Kubernetes in particular is reports the virtual memory rather than the in-use.
In-use is only a couple of dozen MB
 
True story: I once accidentally forgot a var_dump() in code that was deployed to production at tumblr.
 
fpm pool?
 
@MarkR The extensions are built as shared most likely
I can't remember if you compile them statically if the kernel is smart enough to figure out to share the memory?
probably not
 
7:34 PM
@NikiC Thats valid but i think its mainly used for security its even the first sentence in the docs: This directive allows you to disable certain functions for security reasons.
 
@user3655829 Preventing human error is a form of security
 
That is not what every user out there thinks if he encounters this "security" feature
sorry but google it. The first page is full of disable_function=popen,socket....
thats not done for human errors
 
@MarkR Also, consider that once the process allocates memory it doesn't release it back to the system until the RSHUTDOWN stage. So the heap grows up, never down.
 
Empty script with just a sleep(..) in it. Just seems like an awful lot.
 
@MarkR What's your opcache buffer size?
 
7:39 PM
@MarkR Look at lsof -p <pid> see if maybe you're loading some weird extensions?
 
Ah ha. 128mb
 
ah that'd do it
 
Thank you @NikiC
Didn't realise it would claim the entire chunk up front
 
probably be slow to do it dynamically
 
@MarkR And that's why virtual memory usage is a completely useless metric ;)
 
7:41 PM
Well.... there are cases when its meaningful though
 
Because first, that memory is shared between all processes. And second, just because that much has been mmap'd doesn't mean that it's actually used
 
Particularly if you're trying to stress test exhausting memory
But generally, yeah, not useful
 
Yeah the actual used is much lower. It was just throwing out the scaling metrics.
 
@Sherif Exhausting virtual memory is pretty hard...
 
@NikiC For sure, but I've had that issue at scale before :)
 
7:43 PM
Like, some sanitizers will routinely allocate something like 1TB of virtual memory for shadow structures ;)
 
routinely is a considerable exaggeration there, I'm sure.
You can run out of addressing space you know.
 
@Sherif Actually an understatement. It allocates 20TB ;)
 
Jesus
That seems a /tad/ excessive.
You must be using ultra highspeed DDR4 memory to make such bold moves
 
8:45 PM
@MarkR what did you tell kubernetes to avoid the problem? I faced this with go binary and virtual memory and got annoyed yöby it, just playingarounf
 
I disabled memory limits in the container
It'll take a bit more investigating still though.
 
Will it scale the pod to infinity then?
 
If I did something to cause it yes, but because I disabled the memory limits it wont count them in the horizontal pod autoscaler, which isn't ideal, but it's fine when everything is CPU bound
 
if columns are all uppercase, will PDO::ATTR_CASE => PDO::CASE_LOWER convert them to lower on fetch?.
 
@Ghostff What happened when you tried it?
 
9:01 PM
Nothing, but maybe my fault.
Just wanna make sure.
@Sherif yeah nvm it was my fault.
 
9:37 PM
I'm having a blank moment, do we have a function to set the internal array iterator to the position of a specific key..?
 
@MarkR Not that I ever heard of
forward, backwards, rewind, end, that's all I know
You gotta follow the linked list.
 
I'm wanting to read the last <?> items off the end of an array but only after a certain key, I've used a couple of while loops, one to traverse backwards until I find the key, and one to traverse forward from that point to get the elements, but seems a bit convoluted.
 
@MarkR You can do it in a single step. Store it backwards as a LIFO stack
 
Yeah considered it, and then reversing the output.
I'd have to do a tweek to move the key into the data structure though, although that's not terrible.
 
10:09 PM
@MarkR You may be able to use ArrayIterator::seek().
 
Thanks @Trowski I'll take a look
 
@MarkR Why would you reverse it? Just shift each element onto the beginning of the array as you go
 
function iterateFrom(array $data, string $key): \Generator {
    $iterator = new \ArrayIterator($data);
    $iterator->seek($key);
    yield from $iterator;
}
I think… didn't actually try it :-)
 
@Sherif I was wanting to set integer keys and afaik unshift wouldn't allow it.
 
Aww… seek only works with ints
That's sort of pointless then…
 
10:17 PM
I could do as Sherif suggests and shift onto the list from the front, but I'd need to change my data structures to store the key along with the data, and the same for the results.
 
@MarkR Why's the key important?
If it is then that'd be the way to do it. If it's not then just throw it way.
 
It's used to unset the value in the array when it is superseded by a new value which would get pushed onto the front. It means the overwrite mechanism would have to search for it in userland to remove it, i'd need to profile it but that might be a worthwhile tradeoff. The alternative would be a second array which maps what would have been the key value, onto the actual key value.
But could be that it just makes sense to eat the few hundred userland calls on write rather than read.
 
@MarkR Oh you always wanna aggregate on write as a rule of thumb
 
I'll do a bit of profiling, see what it turns up
 
10:48 PM
That works, had to wrap the data structures and jiggle them around a bit but it's definitely cleaner.
 
11:05 PM
hi
 
11:23 PM
I asked a question, selected a correct answer, then discovered it's not correct. What is the correct stackoverflow etiquette for this situation?
 
I think I'm gunnu move to Switzerland, apparently they have the best healthcare in the world and they pay software engineers the most in the world
 
00:00 - 19:0019:00 - 00:00

« first day (3393 days earlier)      last day (1552 days later) »