« first day (3390 days earlier)      last day (1564 days later) » 

11:00 AM
hellos
 
@bwoebi Eh, = is just customary there
 
@NikiC even in maths? thought = was just for CS
 
@PeterTheLobster The important question is, are you ever going to try and move it somewhere else without completely rewriting the code in other ways?
If yes then you need some sort of abstraction layer anyway
if no then sod it, more important things to worry about than decoupling from things you are always going to be using
 
@bwoebi It's customary in maths and physics as well
You want to be able to write something like f(x) = x² + O(1)
 
maybe you do
 
11:06 AM
even then, maybe not
 
@NikiC ah ... true.
 
\o
 
cmb
\o
 
11:18 AM
@JoeWatkins @NikiC could you help me with correct way of handling PHP exceptions inside object handlers. In these handlers PHP doesn't expect PHP exceptions, so it handles them only partially. I want to catch exceptions myself and emulate them globally via EG().
 
@lisachenko not sure I understand
PHP does expect exceptions in these handlers
 
what he said
 
@NikiC no, because if i try to install my own hook, say (get_property_ptr_ptr) then I can not throw PHP exception from FFI...
And it generates an exception FFI\Exception: Incompatible types when assigning to type 'struct _zval_struct*' from PHP 'unknown'
 
sounds like you are doing something wrong rather than it being unsupported
 
FFI excepts me to return value from my callback and when I throw a PHP exception, value is not returned obviously...
 
11:24 AM
like most things you ask, your question just raises more questions and I don't like any of the possible answers ...
 
Ugh, yes, I know...(
 
@lisachenko ah
 
you need to return an expected value, even if you throw an exception
 
So, let's check step-by-step
 
will yes, you can't throw the exception across FFI boundary. But you can carry it across EG(exception) as usual
 
11:26 AM
Can object handler throw a PHP exception (not a zend_throw_**)
@NikiC yes, this is what I want to emulate
 
Actually, how do exceptions with FFI work at all?
 
whether you call zend_throw or populate EG(exception) should make no difference, except the api will do it correctly, the problem is your handler is not returning ...
 
@NikiC It handles them in specific parts and can't do this for another one...
 
throw in C (zend) is not the last statement, it doesn't change the control path
so populate eg(exception) probably with the api, but you still have to have your handler return something (NULL, probably)
 
@JoeWatkins but I can handle exceptions myself, set global EG and return uninitialized zval for that case? Right?
 
11:28 AM
that's what an extension would do
 
Ok, perfect, then it should work for me as well
 
(or it would use the api) ... but it's very normal for handlers to throw exceptions, as nikita said
 
@JoeWatkins PHP exceptions? or via zend_throw_*
 
I don't understand the "or", zend_throw raises a php exception ... most extensions use the zend_throw api, I've never seen any that work with exceptions directly
(they probably exist, somewhere)
 
Ok, let me check first if I can emulate internal logic via EG
 
11:34 AM
lastly, I hope you took note of constness before changing that handler for any object, what you're doing may not be safe
I guess you knew that ...
 
@JoeWatkins yes, sure, it's for one class. I can not change default std object handler, so it is per-class
 
you've changed create_object per class ? what if the class is immutable ?
you know what don't answer
sounds great ...
 
I have implemented immutable objects. It install interface_implemented handle on Immutable interface which changes the create_object entry with new handlers, and rewrites write_property and get_property_ptr_ptr to implement immutability for object
 
@JoeWatkins pretty sure the SPL extension must do some whack stuff like that
 
@JoeWatkins all user classes are mutable (afaik)
 
11:37 AM
nope, once stored in opcache they are immutable and marked ZEND_ACC_IMMUTABLE on ce_flags
obviously you can't change cached code
 
create_object handler can be changed for zend_class_entry?
 
not if the class is already immutable at the time you want to make the change
 
From what I can see, I can manipulate this field in runtime (opcache is enabled)
 
(if it's already cached, you can't change it, same as code)
 
only the requirement is to return default value back at the end of request
 
11:40 AM
enable mprotect
 
for handlers
 
if it's in opcache you can't change it, and I don't know how to say those words in an order you'll listen too ...
 
@JoeWatkins thank you for teaching me ) I will try to solve this issue, now it's more educational process
 
@lisachenko opcache.protect_memory=1
 
@NikiC oh, such a good option. Thank you! Will check now
By default, opcache.protect_memory=0... What was the reason for that default value?
Ok, I can confirm it still works even with opcache.protect_memory=1
 
11:48 AM
Good Morning!
@DaveRandom IT'S FINALLY HERE!
@PeeHaa o/
 
hola
 
12:04 PM
@NikiC ok, handling exceptions with PHP try..catch section and passing caught exception instance to zend_throw_exception_object functions works. Handler returns EG(uninitialized_zval) for exceptional cases now. Thanks! /cc @JoeWatkins
nope ( Still getting FFI\Exception: Incompatible types when assigning to type 'struct _zval_struct*' from PHP 'unknown'
 
have you guys tried to optimize a gif file? I want to reduce a size of it. Can you give me advice?
 
So, in short: FFI + Zend object handlers + PHP Callback (FFI trampoline) + PHP exceptions = ???
It works, but ugly...
 
12:44 PM
o/
 
@shigg if you're on Windows, have a look at screen2gif. Not sure if it can optimize gifs exactly but it does a lot of stuff with gifs, so it's possible
 
1:13 PM
@StatikStasis oh wow, your swedish-made penis enlarger has arrived at last? Took its sweet time. Hope you get the results you are so desperate for.
 
1:38 PM
@NikiC From what I can see: it isn't possible to play with EG(exception) from userland and FFI, because when I change it, then next expression immediately throws this exception, so I can't return a value from callback. Interesting side-effect on working with PHP from rear side...
 
1:59 PM
@lisachenko at what point in time shall the exception then be thrown?
 
@bwoebi I would expect that internal callback will return a value, so FFI won't complain about return values (or handle this separately), then PHP will check EG(exception) and throw it
@bwoebi maybe it's just a bug in FFI then... If callback throws an exception, and function is declared as function with return value, then fill return value with EG(error_val) or EG(uninitialized_val) somehow...
 
@lisachenko well, retval is pre-initialized to IS_NULL when an internal func gets called
 
2:16 PM
@bwoebi I think this issue is not related to retval handling, because exception could be thrown and code works, but it always contain nested FFI exception about incorrect assignment of return value from the callback. It's quite a rare case when a PHP callback is called as a C code (via trampoline) and throws a PHP exception...
So, I'm considering this as a bad side-effect of hacking PHP engine from PHP itself.
 
@lisachenko yeah, you'll need to delay the exception throwing until after FFI is not in control
 
@bwoebi it is impossible...
@bwoebi Or you know some dirty tricks to delay exception throwing?
I have tried to look where EG(exception) is checked ))
 
@lisachenko one dirty trick I have in mind is pushing an object with rc=1 and exception throwing destructor onto the function parameter list
which gets freed right after the internal call
(if it's inside an icall obviously)
 
@bwoebi omg, I like this idea )
 
Housewife Delays Exception Throwing With This One Neat Trick
 
2:25 PM
@bwoebi but is it allowed to push parameters for this function within function body??
 
@lisachenko with ffi you can do that for sure ... it'll just work out
just increment ZEND_CALL_NUM_ARGS() and add it after the last arg
 
@bwoebi call frame is allocated during FFI trampoline call, I'm not sure that frame will contain extra memory for one more argument, it could raise a segfault
 
@lisachenko the vm stack is large enough
 
@bwoebi idea is good, but I would prefer to go as-is for now, exception could be thrown at the end. And ideal exception throwing is tricky for this concrete case...
 
3:07 PM
is web administrator even a job title anymore?
 
for a spider, certainly
 
3:34 PM
\o
Anyone have any opposition to me adding ZEND_API functions for all the Exception methods? Currently that code is directly implemented in the ZEND_FUNCTION, would be nice if going forward our extensions could use them without invoking PHP methods for compatibility sake.
 
@LeviMorrison YES PLEAS!
 
There's probably a whole host of functions that meet this same situation; I just know the exception ones are a pain in particular because you can't easily inspect exceptions from a debugger :)
Having a zend_exception_getmessage(...) function would make that a lot nicer.
 
just because this should probably be done for everything is not a reason to just start with a few
 
I'm in NYC for the week, so it will be a bit easier to communicate with Europeans. Excited about that :)
 
@beberlei +1
 
3:42 PM
@LeviMorrison I don't understand
oh wait, you're not suggesting to make the ZEND_FUNCTION an API
Just expose the functionality?
 
i am more interested in the stacktrace than the message, but the sentiment is the same :)
 
Right, I'd do all exception methods.
 
yeah sure that's totally fine
Actually @beberlei didn't you do a PR for the stack trace?
 
I may expose an API for getting the trace as a string, with and without parameters. Parameters can contain sensitive info. I know ddtrace has an implementation that omits parameters and assume others are interested as well.
Think I should implement that in one function with a parameter, or use two separate functions?
 
3:53 PM
@NikiC did I? i don't believe I did, i thought about it, maybe talked about it
 
@NikiC lol... that is 3 years ago, forgot all about it. ;)
that would be handy had i followed up.... damnit :D
 
Great, I love debugging configure issues:
/Users/levi.morrison/Projects/php/branch-master/Zend/zend_operators.h:781:10: error:
      'asm goto' constructs are not supported yet
        __asm__ goto(
 
checkIfStringStartsWithUppercase, checkStringStartsWithUppercase, which would be a better name for a function? or something else entirely?
 
isFirstLetterUpper()?
 
4:01 PM
I like that
 
@Tiffany or PHP style: fUpper()
Why be verbose when you can stand to confuse so many?
 
something something visual debt
 
Technically speaking it's sentence case in libicu
First case upper = Sentence Case, Each word upper = Title Case, etc...
 
I was testing myself to see if I could answer some simple programming problems when my brain isn't prepared, and turns out I can, so there's some hope for me.
granted, I needed access to google :/
(I've been doing housework, so wasn't prepared at all for programming)
 
4:22 PM
@Tiffany Here's a fun one: gist.github.com/emptyheap2019/6a53c863b4cc3e4522eb7889f6368166 should be fairly easy
Even more fun is write Fibonacci sequence in a for loop with no body :)
 
I always struggle with these...
 
@Tiffany Break it down. How do you check in your head that a palindrome is a palindrome?
What steps do you take?
 
I mean it's basically check if something's a palindrome, loop through each digit, and compare the two
 
@Tiffany Compare the two what?
What two things are you comparing?
 
I got a step ahead of myself
 
4:26 PM
No, you're on the right track.
There are two things that need compared here. But what are they?
 
needs to go from outside to inside, so compare first digit and last digit, second digit and second-to-last digit, and so on
 
That sounds like hard work
 
@Tiffany That's the key. So how do you implement that?
 
Is this one of those challenges where people expect a long answer but someone can just do it in one line?#
 
@MarkR In a whiteboarding interview I'm mainly looking for 3 things: 1) Can you actually write good code, 2) How do you deconstruct complex problems, 3) Can you communicate well so that I know that I can work with you and that you won't be impossible to deal with
 
4:30 PM
@MarkR unless there's a function that does it automatically... but knowing PHP, there probably is ...
 
The code is just what gets that conversation started
 
There is @Tiffany
You can completely ignore that it's a number
 
If you're looking for a function to one-line it you missed the point of the exercise entirely.
I'm interested in how you think not what you memorized.
 
would it be cheating if I cast the number to a string, so I can use strlen...?
 
@Tiffany Nope. That's perfectly fine.
@Tiffany FYI: Asking for direction is one important part of this interview :)
Taking direction is another.
 
4:34 PM
If I asked a person to solve this problem, I'd expect them to have it done in 20 seconds using 1 line of code.
 
Be sure to ask your interviewer good follow up questions to clarify the requirements. Don't just assume you know what they mean.
 
I wouldn't personally 1 line it, it would be unreadable
 
I'm running out of scratch paper
 
Probably right Dave, depends on if you want the ternary or not
 
it probably can be done, but it would be a mess of nesting
 
4:35 PM
oh yay, scammer call, and I asked him the problem, he hung up
 
oh wait
 
The correct answer is "Use typehints so you don't have to deal with nulls you monumental twit"
 
@Tiffany: I'm going to leave you with the solution because I have to go, but have fun! gist.github.com/emptyheap2019/2242bd68cbd3706b5c1bf5fe522d12db Check out hackerank if you're interested in more practice problems like this
 
@beberlei or @NikiC Any idea why getMessage and such are doing a deref before copying?
 
function is_palindrome(string $data): bool
{
    return $data === strrev($data);
}
 
4:38 PM
Pretty much Dave. That's the answer i'd look for
 
Ruby chat is dead. If anyone knows ruby and can help me out with a simple model logic problem please message me!
 
the only problem with that is that it's not memory efficient
 
but for reasonable sizes of $data it's simple and obvious
 
Palindrom doesn't need to have even number of digits (characters)?
 
4:40 PM
Equally, using PHP itself to do multiple array accesses in a loop is not CPU efficient. 1 function call to C to reverse it, one function call to C to compare it. Job done.
 
indeed, PHP != C
 
@Tpojka No, "A" is a palindrome. So is "ABA".
 
and ABBA
 
and considering both strrev and comparison are implemented in C, much faster
 
tacocat
 
4:41 PM
Then strrev. I like ABBA.
 
@DaveRandom 4 is an even number you know
 
able was I ere I saw elba
@Sherif lies.
fake news
 
@DaveRandom So when I get a smartass like you in an interview that wants to do that I throw them for a loop: "I dad. I" is a palindrome. How do you write a function to prove it.
 
is it possible to access a digit in an int using brackets, like what can be done with strings? e.g. $aString = "tacocat"; $aString[0]; // t
 
You didn't specify natural language
 
4:43 PM
@DaveRandom I don't care about language at all.
 
but just strip [^a-z0-9]
 
@DaveRandom Yea, and what's the BigO on that?
 
@Sherif punctuation is language
 
@DaveRandom Who said I care about punctuation?
 
Tiffany, palindromes are dealing with strings, so cast to string first
 
4:44 PM
Communication so far: [poor]
 
🍿
 
I don't have the brain power for this rn
@Sherif and yes, generally true, I am old and jaded and use the word "fuck" at regular intervals in the office
I'm also fine with only being able to get jobs where that is OK
 
I'd still expect Dave's answer, strip anything that isn't alphanumeric and strrev again
 
@DaveRandom I'm OK with you saying fuck. I just need to know I can work with you. Cursing has no factor in my decision there.
 
@DaveRandom LOL!
 
4:45 PM
I am also generally much better at being constructive with real-world problems
 
Not being able to collaborate on code.... now that does
 
the problem is that I have absolutely no investment of interest in this particular problem
were I to be in an interview it would be a different story
however if I were in an interview where they move the goalposts after asking a basic problem solving question I might get annoyed...
well, actually I would ask for a complete spec
 
The problem is the least interesting part of this equation. How you think, however, is very interesting to me. I could give you problems that will make your brain hurt, but the point isn't to exhaust you. It's to test your deconstruction abilities and understand your strengths and weaknesses.
 
can't write code without rules, computers don't work without rules
 
I do better at "real world" problems is to say "this is too easy for me give me something harder"
Think about it.
 
4:48 PM
my strengths, in case you haven't noticed, don't lie in dealing with people :-P
 
Are you sure you want to pose that hypothesis to me?
 
it really doesn't bother me, I am not an interviewer, nor am I in imminent danger of needing to be an interviewee
 
Here's a real world problem: You're writing a web crawler that needs to check if a given URL is in a list of Known Spam URLs. This list is currently 1 trillion URLs long and must fit in memory on a server that only has 32 GB of RAM. How will you fit this list in memory?
Good luck.
 
I don't have the full solution, but I'm guessing it ends up something like:
for ($counter = 0; $counter < strlen((string) $number); $counter++) {
  $intCastToString = (string) $number;
  if ($intCastToString[$counter] === $intCastToString[strlen($intCastToString)]) {
  // might need a -1 in there, I can't remember off-hand
 
fn(string $x) => $x === strrev($x);
 
4:51 PM
@Tiffany You're comparing the current position to the last position in every iteration. -1 also doesn't help. You'd be comparing the current position to the penultimate position in every iteration.
 
If you want to handle the no characters it's fn(string $x) => $x ? ($x === strrev($x)) : null; ... hate writing code in a small chat box :X
 
@Tiffany Here's a hint. When working with loops, always write down a test case and go through it step by step to see what the result would be.
 
$intCastToString[strlen($intCastToString) - $counter]?
 
Also why are you casting the string with every iteration?
 
Of course, PHP being PHP there's a distinct possibility of it ruining that evaluation \o/
 
4:53 PM
@Tiffany Cool, now what happens when I give you the string "111"
 
I dunno... I wrote down literally what I had on scratch paper, it wouldn't need to be
it should return true?
 
Finding a URL in a trillion URLs: Step 1, install mysql. Step 2, check. Step 3. ??? Step 4. Make a cuppa.
 
@MarkR step 3 is "uninstall mysql, throw computer into a river because it's irrevocably contaminated, buy new computer, install pgsql, repeat step 2"
it's a multi-stage step
 
hah
 
:-P
I actually don't hate it as much as I used to, they are finally starting to fix their shit
 
4:56 PM
I just looked at your solution @Sherif, far more elegant than what I would've done
 
still no distinction between DB and schema, but I think that ship has permanently sailed
 
and I didn't know for could handle that kind of syntax
 
in PHP it can, in strictly typed languages it (tends) not to
 
@Sherif Collect/scrap pages what is needed then check and throw what you don't need. Depends...
This is concept before dealing with DB.
 
Questions like that always depend on the constraints. How much disk space do you have for example, what type of disk space
You could potentially just write a B-tree straight into one contiguous block of disk and not need to use RAM whatsoever, but blurgh efficency
You might keep the data on disk, and use an in-memory index pointing to specific sections... at which point congrats you've just re-invented every database out there and probably spent 200x as long doing so.
 
5:01 PM
It is not given when will be needed info about spam link: immediately or in a month statistics i.e.
 
Wanna save some space? Crush the URL down to SHA1 and store it in binary so it's only 20 bytes
etc etc etc
 
SHA1 is good 1.
 
Could get away with CRC32 as a first step realistically.
But if you're storing it in binary you might as well just use a longer hash, a decent DB will still branch the trees efficently
 
5:16 PM
Those are valid points but problem is about how to use 32 GB of RAM to check against 32 t strings.
 
The answer is "don't store them in RAM"
 
Not that, but how to efficiently use that size of machine to have accurate checking string against 1 trillion strings.
 
If you take the URL, say google.com which is baea954b95731c68ae6e45bd1e252eb4560cdc45 and build a b-tree that has 256 branches taking the first 2 characters as a byte, after 2 levels your search space is down to 15 million and you've used about 512mb of RAM (based on 8 byte pointers)
Um that should be KB
 
5:36 PM
That is, how one would best create and cache generic class references, especially if there's still type parameters involved
(Not working on this right now, but still thinking about it...)
 
5:48 PM
@LeviMorrison Probably because the properties can be references?
At least once people bring out the reflection
 
Apologies if I'm talking utter BS, but zend_function stores the arg info, if something has generic arguments, and assuming the class reference will be passed as the scope, what about storing just the monomorphized zend_arg_info in the class reference and using a a flag in the original ones to tell it to refer to the concrete values stored in the class reference?
 
@NikiC I think that hashtable solution may work out - but we need to refcount the zend_class_references I guess
 
@bwoebi That would be pretty inconvenient for caching
Do we really need to refcount them?
Sure, it can "leak", but it doesn't really seem problematic for any reasonable usage...
 
@NikiC Well, we'd be going to leak them when including top level code doing instanceof checks at the very least
but it might be acceptable
Still thinking…
@NikiC I'm a bit afraid of runtime cache thrashing when extracting two different types in a loop from a same collection class, i.e. function foo(MyCollection<A> $a, MyCollection<B> $b) { for($i = 0; $i < $a->size(); ++$i) { $aval = $a->get($i); $bval = $b->get($i); /* do something with $aval and $bval */ } }
due to get() being alternatedly called on A and B all the time
so fetching needs to be fast enough for that use case
 
6:06 PM
Could you not store the cache value elsewhere @bwoebi?
 
@bwoebi where is the runtime cache in your example?
 
@NikiC not there, in the get() function
 
@bwoebi For the get(): T type?
 
when anything needs the T parameter there, e.g. when reading from an internal array<T>
 
@cmb Please review my first PR to FFI github.com/php/php-src/pull/5120
 
6:12 PM
@NikiC or that, yes (the cached class entry)
@NikiC Might it be worth having different runtime caches for each combination of generics?
@NikiC at least if we have separate runtime caches, we can also properly cache internal Collection<T> generics
 
@bwoebi I think this kind of naked parameter reference is not an issue, as we just look up the actual type by index. The problematic cases are : Collection<T> checks.
Where I'm really not sure how this can be efficiently cached :(
My suggestion was to cache the reference for Collection<T> and have an HT on it using which you can look up the more specific reference for a particular type...
But yes, it could also be a polymorphic cache...
 
@NikiC On exceptions? Weird....
 
6:32 PM
@NikiC The only idea I can provide is actually having a map for mutliple rt caches - depending on the actual T a rt cache is used or a new one created if there's none yet.
 
 
1 hour later…
7:43 PM
@MarkR this. Interview questions need to be either 1) "pure" logic tests using a massless frictionless spherical cow in a vacuum, 2) real-world-ish problems with rigidly defined and clearly stated environmental constraints, or 3) explicitly posed with "ask questions to establish the constraints" as part of the task. Asking me something that looks like #1 and then moving the goalposts after the fact to turn it into #3 is just annoying and makes me not want to work for you. imho, ymmv, etc etc
any one of the three options is fine and valid, but pick one
 
@DaveRandom I think he was just annoyed that you gave the answer a battle hardened dev would give rather than a newbie :P
 
well @Tiffany isn't exactly a newbie, and tbh I feel like it took me way too long to see that answer :-P
I am going to look into specifically palindromic numbers a bit more though, I feel like there's probably a more interesting mathematical solution to it
 
The annoying thing is "0" is considered empty so would probably need to be strlen($value) ? .... which is just f**king mental
 
base 10 is hard though
well maybe, I would argue that a single character and the empty string could both still be considered palidromic
and again, that constraint needs to be stated if that isn't the case
 
Aye, it's just the boolean casting of "0" which makes me sad inside.
 
7:48 PM
@MarkR yeh, the '0' issue is one of the stickiest in all of PHP imo
I completely understand why it's like that, but it makes things harder than they need to be very frequently
 
actually, where the hell is that thing searches for boolean_not
!?!?! if (Z_STRLEN_P(op) > 1 || (Z_STRLEN_P(op) && Z_STRVAL_P(op)[0] != '0'))
WAI
 
@MarkR the thing is, in the context of the origins of PHP it does make sense. Specifically, it does make sense to have a way to interpret a non-empty string as boolean false when data is regularly obtained from query strings
in retrospect the trade isn't worth (imo) but I can see why it seemed sensible way back when
 
What was right way-back-when can go suck my big toe :| Isn't there meant to be a strict operators RFC to fix this
 
I do sort of think that empty() might make sense as an exception, but obv that's just not possible at this point
anyway, /me has to put The Boy to bed, bbiab
standard procedure he's decided he needs to take a crap for 10 mins :-P
@MarkR I know what you are saying and I'm regularly firmly on that side of the fence, but in this specific case I just can't see it being practical to change that behaviour. It would break soooooo many things, enough things that BC is a solid argument here
the bugs it would create would be so varied and subtle that it would create more problems than it solves
 
I think wiki.php.net/rfc/strict_operators should have it. Comparing strings to numbers is explicitly prohibited and "0" is 10x worse than that
 
8:00 PM
yep. it's weird when you are testing for empty string but perfectly fine if you are handling numerical input from external sources
 
I have seen the idea of a ??: binary operator floated before (identical to ?: but for '0') but that sounds horrific
 
I'm not sure what Arnold's tag is on here. How to find out if that RFC is going to be moved to vote?
 
I'm not aware of him ever coming into #11
seen him on irc a few times I think
I've not been on there for ages though
 
@MarkR I think this RFC does not solve actual practical problems, but edge cases, which may occur, but are at large only relevant for academic purposes.
> it concerns input data, for instance from $_POST, it's recommended to use the filter functions.
nobody likes filter functions, they are just clutter
and bloat your code
 
I'm still gritting my teeth that putting ?input[]=... on most PHP websites can cause most of them to HTTP 500
 
8:05 PM
@MarkR only … if the target website has types
 
Or tries to do anything where it would get cast to a string... e.g. any string manipulation function
 
for old style websites it'll end up casted to 0 or "Array" or maybe emit a warning
 
@MarkR related, I've never seen a formal spec for all aspects of application/x-www-form-urlencoded, is there one?
I've often idly wondered about that
 
@DaveRandom there is none
 
/me will really bbiab this time
 
8:07 PM
evenin'
 
the closest you can get is the definition on w3c
apparently that one is new
but there you go
 
whoa.. just tested ?input[]= on my old PHP5 or PHP4 website (can't remember) and nothing bad happens.. :)
 
Do we have memory manager hooks for tracking things like allocations? Thinking about memory profilers.
I know we have a GC trigger hook, but not sure about smaller grains.
 
@LeviMorrison you can use a custom allocator (which actually is backed by zend_mm)
@LeviMorrison starting point: zend_mm_set_custom_handlers
 
@DaveRandom I'm not a newbie, but I'm also not a battle-hardened dev :P
 
8:18 PM
The newer devs try to impress by writing fancy code, the battle hardened devs tend to write what works by putting together the right tools so they can move on to the 50,000 other things they need to do before the end of day.
 
Well, to a point :-P
Sometimes they fall down a hole because they are so used to complicated problems that they fail to spot a simple one
 
That too
 
And by "they" I mean me
 
I saw something that almost made me cry last night. Someone on r/php was asking for job advice, and had linked their github repo for what they wanted to show off to potential employers. It had a dozen SQL injection vulns in about 5 lines of code.
 
8:34 PM
@MarkR array_walk_recursive([&$_GET, &$_POST, &$_REQUEST], fn(&$v) => $v = addslashes($v));
 
I feel like PHP should include signature detection for anything that looks like that and trigger an unblockable E_MAGIC_QUOTES_DIED_FOR_A_REASON
 
haha
 
The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility, and among other things he avoids clever tricks like the plague EWD340
 
Or in the event the clever trick is used, it's at least documented.
 
@LeviMorrison there are clever tricks ... you can write a 50 lines of docs for 20 lines of code and enough people won't manage to wrap their heads around.
 
8:47 PM
Especially when math is involved...
 
@LeviMorrison previous employer's code base has this function to get the domain name of something and used a bunch of functions chained together in a weird way. It was commented by the developer to explain what it did, but it was a mindfuck to glance at.
I may have pasted it here at one time...
 
I am in the both envious and difficult position of being the only one working on this codebase
So when I get angry at lame code, it's myself.
 
@MarkR Arnold's tag is @Jasny-ArnoldDaniels
 
At least you'll be able to quickly fix most of the bad code without trying to understand somebody else's thoughts..
 
@lisachenko you want Dimitry to review that code more than cmb i'd say as he's the maintainer of the extension
 
8:59 PM
I'm in the same situation..
 
@Jasny-ArnoldDaniels Hey Arnold! Are you planning on moving your strict operators RFC for 8.0?
 
cmb stands for Melchior, Balthasar and Caspar?
 
No for @ cmb
 
ok, sorry
 
@MarkR you made that pun on purpose, didn't you?
 
9:03 PM
Yes :D
 
isn't Spaß verboten? :)
 
@Code4R7 only when @Gordon's around
 
That's good to know :)
 
I should make myself a random generator to decide stuff for me. I miss Jeeves' !!should I plugin
Or I could flip a coin, I guess
 
What do you miss about Jeeves?
He never answers my questions... :-P
 
9:16 PM
The !!should I plugin
Making hard decisions for me so I don't have to, like should I have pizza tonight
 
In the spirit of stack overflow... that's a stupid question
The answer is ... how much pizza should you have tonight
 
@Tiffany Looks like you're in need of The Book of Answers
 
@MarkR if I bake the frozen pizza in my freezer... probably an entire pizza... maybe half and save the rest for tomorrow...
@Code4R7 I'd rather use RNG
 
It's around 22:20 here.. I'm off to sleep. Good evening to you all.
 
Goodnight
 
9:55 PM
@DaveRandom This seems you abandoned strrev solution (and why if so)?
 
@Tpojka seems more like a case of curiosity
"hmmm, I wonder..."
 

« first day (3390 days earlier)      last day (1564 days later) »