« first day (2536 days earlier)      last day (2402 days later) » 

4:00 PM
@Tiffany there are four major attack surfaces frontend (using XSS/CSRF or phishing), php (when someone manages to inject PHP code), webserver (when there is a vulnerability in apache/nginx) and database (usually via SELECT ... INTO OUTFILE)
 
@Leigh I found a contact email on the server, it's \@gmail, did you already grab it?
 
I did not go on
 
would you like it?
tempted to fix the problem while I'm here
 
lol
 
This isn't really the place to discuss things :/
 
4:05 PM
@Leigh drop me a line @gmail.com?
 
And I'm as guilty as the rest up til now, so yea
I dropped you a private message on twatter
 
also fine
 
And Tiffany I dropped you an explanation of how, specifically, now don't abuse that
 
@Leigh thanks, and I won't.
 
4:36 PM
posted on September 25, 2017 by CommitStrip

 
@Dereleased Okay, I think I'm open to switching this to not use eval, because I think it may make what I'm trying to work on easier. What was your suggestion? $object = $class.'::load($row)';?
 
mood is weird
 
@Tiffany what does it do?
 
I need to add a namespace to it
I think
 
which php version?
 
4:43 PM
5.3
 
shit
@Tiffany, you can just remove the eval()
I think
Lemme check
of course, it would be a lot better to rewrite it without the static call
 
so $object = '\\' . $namespace . '\\' . $class . '::load($row)';?
 
not sure if it will work, lemme test
 
it gets called from another class
like this
static function loadResult($result)
{
    return parent::loadResult('Site', $result);
}
oh come on fixed font, there we go.
 
@Tiffany 3v4l.org/JQ6WM like this ... just set the class name to a varaible before executing
 
4:47 PM
obviously I will need to add another argument to the call
 
(the fully qualified class name)
 
so I don't even need to use quotes on the static method
$object = '\\' . $namespace . '\\' . $class::load($row);?
 
@NikiC seeing a weird behaviour in my extension based stream http wrapper, this commit here suddenly makes accessing $http_response_header not possible anymore in a callback wrapped around the default stream_opener. the symbol_table returned from zend_rebuild_symbol_table() returns 0 elements.
 
$name = "\\{$namespace}\\{$class}";
$object = $name::load($row);
 
4:52 PM
^^^ that was the one @Tiffany (what @tereško said) chat.stackoverflow.com/transcript/message/39312359#39312359
 
hm?
 
@Dereleased @tereško thanks
fingers crossed I don't fudge the code up
 
but I would mark it with /** @TODO: get rid of the static calls */
 
what should they be replaced with?
 
for now, leave it as it is
 
4:55 PM
added the todo
I guess I should fix all other instances that are using eval
 
what it should be in future, would depend on the structure of the rest of the code - but it would having an instance of a class instead on making static function call to global scope
(I suspect, you still need to learn some stuff to know how to do that)
 
so using $someClaseName = new ClassName and calling methods through that?
 
that's how the next iteration would be likely to look like, but that entire snippet seemed suspicious to me
it would seem that your "models" contain SQL queries (which is one of those "future things to fix")
 
yes
they do
 
and they probably all have 50+ line methods, with a lot of logic and sql all over the place
 
5:01 PM
@tereško you remember the ModelBase I showed you last week?
Model itself doesn't have any database logic
 
hmm
 
will continue to work on it after lunch. huuuungry.
 
yeah, I'm off to home
 
Wes
5:23 PM
\o
omg the cassini pictures
 
@beberlei My guess would be that it no longer creates the variable if it's not used
And you're relying on it existing even if it's not used?
If you insist we can force creation, though what I would recommend is to use the stream wrapper data instead
 
Wes
@NikiC \o i've spotted something strange in php7 and i'd love having it explained. gist.github.com/Netmosfera/b0e7c22a8bbd2460f1a6f71322297269 these two files are basically identical, except that one fetches a field on an object rather than returning that object. how do you explain that fetching that field makes things slower in certain cases?
i don't get what's happening
 
@Wes Why would it be unexpected that fetching a field is slower than not fetching a field?
 
Wes
basically calling 1000 times

$foo->method(...)->field

is faster than

$foo->qux = $foo->method(...); called once
$foo->qux->field; called 1000 times
 
5:39 PM
That seems unlikely
 
Wes
check the two files please. i am 99% convinced that i didn't make a mistake :B
 
@Wes To me it looks like you're always doing the method call anyway
 
Wes
calling 1000 times

return $foo->method(...)

runs about as fast as

$foo->qux = $foo->method(...); called once
return $foo->qux; called 1000 times
basically fetching the field makes a difference
in php 5.6 the times are what i expect them to be. in php 7 fetching the field somehow makes things slower
3v4l.org/3Gr0Y start from this. how do you explain that the one that calls the method several times rather than just once runs faster than the one that executes the method several times?
 
6:02 PM
hey room 11 maybe you can help me decide what to do with JSON_THROW_ON_ERROR
I want to put it to a vote, and I can now, but there's an unresolved issue
So, json_decode() and json_encode() have three kinds of errors. 1) parameter parsing (zpp), 2) depth, 3) everything else
1) is always an E_WARNING and return NULL (except in strict mode), and a flag can't change that
3) sets a global error code and you can then check that error code with json_last_error(), but my patch changes it to throw a JsonException with that code
so the problem is (2). if you give a depth that's < 0 or > INT_MAX, it produces an E_WARNING and returns NULL
but there's no associated error code, it doesn't even touch the global error state
so I don't want to make it a JsonException because then it would need a code
I could make it an Exception maybe? idk
also I noticed both functions have a depth parameter but only one validates it, so maybe I need to fix the other function
Scintillating stuff, I know.
 
@Andrea What's wrong with it needing a code?
 
@PeeHaa I mean I could add one, I'm not sure why I'm avoiding that
…that'd solve all my problems actually
 
:P
 
Wes
where do you find the strength @Andrea :P
 
@Wes I don't :p
 
6:10 PM
how did I end up as the diplomat for a war game
in one day I went from the lowest rank in the guild, to an officer, to being the guild's diplomat. I have no idea what I'm doing.
 
Wes
what you are proposing would be awesome if json_encode defaulted to throw. but sadly it can't be that way. i often say it, php can't be used unless wrapped first in a sensible api
it's not bullshit. there are "better" version of the core stuff for everything, dom, datetime
what i'm saying is, that unless it throws, it's not actually going to be an improvement, because people will need to remember to add that flag
there's reflection, countless dbals, basically everything. perhaps also json shouldn't be used raw. there should be an userland package that fixes design mistakes like that
@Andrea but in case, "the best way to piss off a programmer is throwing generic exceptions"it's a quote, i don't remember the author :P
 
Error: An error occurred.
!@#$
 
@Wes You sure it's not just a quote because you put it in between double quotes? :D
Maybe signed it - Abraham Lincoln for more credibility
 
6:31 PM
I have a question, and hopefully I can word it coherently...
 
Wes
@PeeHaa i've read it on c2.com's wiki
maybe on this page, if you have the time to read it :B
 
@Tiffany I have waited for three minutes now. I'm voting you can't.
 
gimme like one more minute, I'm typing it now
and if you're wondering, select all - cut
actually... I think I might have figured out part of it
text boxes are great rubber duckies
 
I'll go back to zombieland soon.
 
I need to pass a namespace to this function, and I need to figure out what
I'm guessing the namespace that class is defined under
 
6:37 PM
Every class has a ::class attribute. Try that
 
so I need to add an argument to match the parameter
 
What's wrong with using the NAMESPACE constant?
 
@Tiffany uuh. that's awkward. why would I need to pass the namespace separate from the class?
 
"NAMESPACE"
 
@Ishmael because that evals to the namespace of whatever you wrote it in which is not necessarily the namespace of the class that she wants to call load() on
 
6:40 PM
@Gordon it couldn't find the class after I added namespaces
 
are the classes in the same namespace?
 
@Tiffany the function apparently concats namespace and class and then tries to call load() on it. so what classes have a static load method?
 
these particular ones, yes, but I don't know how many calls are made to this method, and there may be a case that there are different namespaces
 
/cc @Wes @Trowski
 
6:45 PM
Wait wait wait a minute.
Why are you not using mysqli?
 
@Gordon I updated the gist to show the ::load method
because I need to update this code
and I'm doing one thing at a time
 
@Dereleased :-)
 
Do you work at my company? lol
 
I did not write this code, but I am trying to make it better
I'm the only person on my team.
 
What version of PHP you're running?
 
6:47 PM
I have on my to-do list to convert it to PDO.
5.3
 
Do you work at Lightology?
 
no
 
ok ... phew
 
Wes
@PeeHaa fu anyway. i am not like tyrion
@Dereleased omg, it almost looks like a decent job
 
has anybody here moved from JS to PHP?
 
6:48 PM
@Dereleased I'm jelly
 
That's a thing?
 
@Wes <3
 
@Dereleased So cool cc @Wes
 
@Tiffany, I'm very tempted to click on that link.....
 
6:49 PM
@PeterWard it turns out to be a really bad idea.
 
@Andrea As that's not an error in the JSON input, I'd say it has nothing to do with JSON_THROW_ON_ERROR
 
haha
 
Wes
@Trowski next iteration we need to add amphp.org i think
 
@Danack is the author of what I linked
 
Okay so back to @Tiffany I am a person who has lived through the fire of anything before 5.5. First off relying on Reflection class is going to constantly run you into a wall so be careful using it.
 
6:50 PM
@NikiC you are right, it works accessing stream->wrapperdata, much simpler code as well. however if there is a stream failure now, i cant access the http.status anymore, because the stream_opener returns null.
 
Note there is a way to load mysql into an object.
You can also autoload your classes so they can load without having to specifying the namespace
 
@Tiffany not enough context for me to solve it
 
@Ishmael the code already has an autoloader, but I want to add the code to composer which requires namespaces
And my skill level is still pretty low in regards to this stuff. I'm learning as much as I can.
 
oooooh boy
 
@Gordon what would help?
 
6:53 PM
Namespaces not hard.
 
@beberlei Is using ignore_errors an option?
 
@Tiffany: what's wrong calling the class by the full namespace?
 
I have no idea, because I don't know what you mean
I'm going to take a break from this and work on something else.
 
@NikiC no, i hoop into arbitrary code to trace, i cannot change the behaviour
hook
 
@Tiffany Don't forget PHP has a mysql_fetch_object function (php.net/manual/en/function.mysql-fetch-object.php)
 
6:59 PM
@Tiffany more code would help. but take your break. I'll go to zombieland.
 
@beberlei hm okay
 
@Tiffany isn't loadResult throwing ArgumentCountError (Missing argument)?
 
in that case we'll have to force creation
 
Anything pre 5.5 without experience is a terrible situation to be in.
Like.... wew.
 
@beberlei Can you check that changing this 0 to a 1 in github.com/php/php-src/blob/… makes your original code work again?
 
7:01 PM
@NikiC recompiling with the change to chck
 
I've worked on two codebases now that are pre 5.5 and they're absolutely garbage.
I also witness someone manage to create their own json_encoder/json_decoder
 
Anybody feeling like solving a simple PHP Quiz?
 
s/two|that are pre 5.5//g;
 
My question is in the comments below the code, @Danack - You are familiar with that ;)
not Quicksort but Insertion Sort since the array has 6-15 elements
uosrt(), 2 parameters of the callback function ($a,$b) - only $b gets moved and this depends whether the return of the callback is negative, zero, positive (zero - $b stays in the same place)
if the callback returns 0 at all times the $a-$b pair would go simply from left to right (or from the lowest array index to the highest, just creating pairs), if $b gets returned as negative or positive, there is more steps, Insertion Sort searches for a place to put the $b
this is taking me like close to 10 days to figure out, so far; the hardest example that I have come across so far...
 
@NikiC yes, works with the chang
 
7:14 PM
pastebin.com/0gJe4ieQ - good explanation of how the code works
 
Request hangs and not finish – #75255
 
Another day another opcache bug
 
wait empty functions can do that?
 
@beberlei ok, then we'll go with that
 
aws terminology
 
7:22 PM
@Dereleased how can I remove the eval in this?
 
@NikiC cool! i was fine working around it tbh :)
but i guess it is a BC break
 
@Tiffany $this->{ "write_" . $name }($value); I believe, will test one sec
 
@Dereleased had to double check for 5.3, but it works
danke
 
Bitte! =)
 
Is 39 characters too long for a function name?
 
7:27 PM
@JennaSloan Does any conjunction appear in the name? (e.g. "and", "or", "but", etc)
 
@Dereleased There's an "or" in the middle
 
@JennaSloan smelly. Can you give us the function name?
 
The function's name is currently "file_get_contents_or_abort_if_too_large"
 
I have less of a problem with that than I thought I might
 
why_is_that_function_name_so_long
why not just file_get_contents and have a mixed return type of data | bool ?
or have it throw an exception?
 
7:35 PM
I'm delighted towards my mac … It attempted to install High Sierra off a corrupted dmg (crc32 check failed) and then failed midway with no real way to restore … Redownloaded and replaced the faulty dmg from the laptop via thunderbolt, but sigh.
 
@Dereleased yes.
It just straight bypassed validation when installing
 
@bwoebi how do these things happen to you?
 
If only I knew that…
 
7:38 PM
@bwoebi Well, here is something to lift your spirits, I hope =/
 
@Dereleased Is that a German interpretation of Internals?
 
@Machavity prollaby
 
@beberlei but is there a workaround?
I mean for the part of getting the headers / status code on a failed request?
 
@NikiC actually no, i dont think so
 
@Dereleased pray tell, for us peasants that do not speak german, what that mean?
 
8:04 PM
@FélixGagnon-Grenier The gentleman on the left says, "I got hit on the head, and when I woke up again I was tied up, and a fireman.", and the one on the right says, "Me too! What's going on here?!" The firetruck reads "Involuntary Fire Department", and is a play on the german term "Freiwillige Feuerwehr", or, "Voluntary/Volunteer Fire Department"
 
8:20 PM
I guess that's german humor, or something ;)
 
@FélixGagnon-Grenier come to Orlando on the weekend of the 14th
 
14th... october?
 
oui
 
I'm afraid I won't be able to
 
I'm sorry, I don't remember offering that option ;)
 
8:24 PM
because, as @PeeHaa rightfully coined it:
2 days ago, by PeeHaa
This is just laziness at this point :D
 
what's special about the weekend of Octobere 14th?
 
@Dereleased hehe
 
@Tiffany I'm going to Florida's Canada
Felix said he'd go with me sometime
 
I still need to get my passport too...
 
to go to Florida?
 
8:25 PM
I will hold up to that, in 6-8 weeks
 
no, I mean in general
 
@FélixGagnon-Grenier Let me know, I have passes, I can go (almost) anytime
 
so what is Florida's Canada?
 
The Canada Pavilion is a Canadian-themed pavilion that is part of World Showcase within Epcot at Walt Disney World in Orlando, Florida, United States. Its location is next to the British pavilion. == Layout == The Canada Pavilion is designed to remind guests of Canada's outdoors. It includes a canyon, a waterfall, gardens, a pool with fountains, and totem poles. The main attraction is O Canada!, a Circle-Vision 360° movie of Canada's cities, scenery and people. The pavilion also includes Le Cellier Steakhouse and the former home of the Celtic rock band Off Kilter. Characters from the animated films...
 
8:26 PM
ooohh
 
Some warning is of course preferred because of the situation with my wife's grandma, we have to ensure she is taken care of
 
Well that's a new one. This demo script uses http_build_query() on an array that is POSTed via curl. ¯\_(ツ)_/¯
 
@Fabor ...and?
 
why would you http_build_query an array?
 
because that's the kind of argument it takes? OH, do you mean a numerically indexed array?
 
8:30 PM
partially, multi-dimensional
 
@FélixGagnon-Grenier here's a calendar for picking light/busy times. First weekend of December looks light
 
I choose YAML over this
 
my boss has been to Disney World every year for like the past five or so years
 
Alone?
 
8:31 PM
no, with his family
 
I have passes, outside of summer months, I'm there every few weeks
Mostly in the ones you can get drunk in
 
Then ride the tea-cups
 
When I was growing up in CA, we went to disneyland a few times. About two hours away.
 
That's approximately the distance from me to WDW
@Fabor I realize this might be seem patronizing, and I really am not trying to be, but you realize that the format of http_build_query() is the same as application/x-www-form-urlencoded, right?
(really sorry about all the pings there @ Fabor)
 
It just seemed like a odd choice over something like json considering the content of the data. It's lists of orders/items etc.
 
8:46 PM
Finally got approval to get the team doing PRs.
 
are you still working with magento?
 
So many companies hiring.
 
wish I could find one near my boyfriend that would take me at my skill level and not pay poverty wages
 
Tiffany, what is poverty wage to you?
 
Depends on the area
 
8:57 PM
Where do you live.
 
What I make in my current location would be poverty wage in a big city, or close to poverty wage.
 
60k?
 
half that
 
what?
no way
 
my rent is 375, but I round up
 
8:58 PM
move on
You can do better, you been doing this for a while, no?
 
not really
 
How long?
 
I don't have a single area of expertise because my job has me do a variety of tasks. Almost everything web-related is assigned to me.
 
@Tiffany Yeah, sometimes I am.
Their custom code is worse.
 
So that makes you more valuable, full stack.
 
9:00 PM
I mean I don't develop all of the time.
 
@Tiffany *droooooool*
 
You do other tasks office stuff.
 
Sometimes I'm the website content custodian, sometimes I'm training people on how to use our CMS.
 
Wes
 
@Dereleased it's a nice apartment too :)
and he let me bring my cats :D
 
9:02 PM
How do I get this deal?
 
move to a rural area
 
375 rent,
here is over 1k
 
@Tiffany Illinois, no?
 
more like 15 hundred
 
@Dereleased correct
 
9:07 PM
@NikiC yeah, I'm just worried people will vote the RFC down because of it
 
Default value & proposed values for flag parameter don't match type declaration – #75256
 
I am available for remote Jobs, in case you know anybody who has a Job or you have a Job for me.
Thanks all
 
Does any of you guys know of a good resource to learn about db schema design etc? I know the basics but can't seem to find a reliable source of information which also includes a real-life example of a medium scale design.
 
9:24 PM
json_throw_on_error in voting please vote for it etc i'm gonna go play vidya
 
9:37 PM
@Ardethian Assuming you're using MySQL, for a guide on creating indexes (which are a part of good DB design), see mysql.rjweb.org/doc.php/index_cookbook_mysql - there's a lot of other good material on that site too
 
I pay 1300 for a two bedroom in SLC. Plus $150 for a garage. It's ridiculous.
 
SLC?
 
where allen
Allen
 
375 rent? That has to be outside of Cook county
Unless you're subletting/splitting
 
AllenJB, gotcha. Thanks!
 
9:43 PM
Geeze 375, even I pay more. Almost double.
 
I don't think a dong comes close to the dollar though :P
 
Should data validation be done in the model or controller?
 
:P
 
Salt Lake City.
 
Model
 
9:47 PM
@SalOrozco The model through setters and getters.
Not a validate method.
 
Should I turn on Opcache on all my applications
 
@Allenph setters and getters of what?
 
@PeeHaa I assumed he was on active record. I guess I should have asked him.
 
@SalOrozco yes, but apparently turn off the fast shutdown bit of it.
 
10:01 PM
@Danack what does the fast shutdown bit do?
 
It's meant to make it shutdown fast. It seems to cause it to crash though: bugs.php.net/bug.php?id=75247
 
!!rfcs
 
Uhm has somebody been tweaking the voting snippet templates :P
 
What are the most common patterns used in PHP
 
10:13 PM
....var_dump() debugging....
 
Why does everyone use Yaml?
I always do configuration in JSON.
 
What is YAML, yet another thing to learn?
 
posted on September 25, 2017

New Cyanide and Happiness Comic

 

« first day (2536 days earlier)      last day (2402 days later) »