« first day (2383 days earlier)      last day (2558 days later) » 

12:53 AM
Hi, I'm auditing a web site and I'd like to know if object injection is possible in the following scenario. stackoverflow.com/questions/43598180/… thank you
 
1:25 AM
unserialize is always a security vulnerability when done on input outside of your direct control
 
1:52 AM
Is the Null Object pattern considered an anti-pattern? I'm not sure I'm okay with an application trying to continue with a fake object
 
 
1 hour later…
Dan
3:14 AM
When the almighty google tells you the answer before you've finished asking the question.
@Jimbo I use it, but depending on the situation, the null-object may itself throw some sort of InvalidOperationException
$invalidState = $validState->someOperation();
$invalidState->someOperation(); // InvalidOperationException
Depending on circumstance, the $invalidState may be permissible to the logic following; in the above case, clearly not. I prefer fail-early, but sometimes failures aren't actually failures.
Moreover, with method-chaining, like builders, you may end up with invalid state, and thus a null-or-invalid-object which subsequent calls try to act on, and it'll throw immediately anyway.
 
 
1 hour later…
4:41 AM
Morning r11!
 
5:09 AM
@Jimbo no, it's not.
I had little use for them over the years in practise, but I like Fowler's take on them, e.g. not NullObjects as such but special cases, like MissingCustomer. Adds some semantics over a generic Null.
But yes, it feels odd to continue with a NullObject because at some point something will not work as defined in the contract
So why not just fail early?
 
5:29 AM
morning
 
Wordpress dev here ?
 
no
 
Anybody knows how to export selective woocommerce products ?
 
5:46 AM
 
ew wordpress
 
6:04 AM
@Akshay : Thanks but I think thats premium , right ?
:)
 
hi all
multicell of fpdf is not working well when there is too much data .Its going into footer of the page and breaking .I mean its not going to next page.
any idea?
I have total number of lines of comment which is calculated
 
6:29 AM
PHP failed to build due to link error LNK2001 – #74495
 
@Exception you need to handle pagination by yourself afaik, or use something better like wkhtml2pdf
 
@Patrick as per my understanding multicell will not work here
I need to read the lines one by and till end of the page reached
 
Does anyone recommend symfony's security component?
 
6:47 AM
symfony is good framework
 
posted on April 25, 2017

New Cyanide and Happiness Comic

 
@CoderDudeTwodee the first sentence in the sf docs sums it up quite nicely: "Symfony's security system is incredibly powerful, but it can also be confusing to set up."
 
7:06 AM
morning
 
o/
 
7:22 AM
meurnin
 
mornin
\o/
 
Morning ^^
 
morgen
 
Is that German?
 
Wes
buongiorno
 
7:31 AM
yowes
@Alesana And dutch
 
Qilachxizax̂
 
I had this ringtone that was quite obnoxious but did the job of waking me up (it was also quite catchy), it was a German song singing Guten Morgen
 
the son likes this very much. keeps telling me "mogn" "wayne" and points at the tv when he wants to see it
 
Morgen latte
Not what you think it is
 
@DejanMarjanovic what "latte" means with morgen?
I got coffe with milk in translation and the same in urban dict
 
7:40 AM
remove the space between the two words and it becomes something else
 
o.o
I'm getting morning leaf o.o
 
a Latte is a long piece of wood
 
Consequently, a Morgenlatte is a long piece of wood in the morning
 
Aaahhh
So, you have your morning latte with your morgenlatte
 
7:43 AM
ask @DejanMarjanovic… he wants to talk about it apparently
 
I need a coffee to understand what you guys are talking about
 
Wes
@brzuchal you don't want to know what they are talking about
 
@Wes I need coffee anyway
 
German humour :-)
 
lol
 
8:01 AM
@Wes I am thinking of how I should be making my code blocks shorter as you suggested, am I doing this right or is this just redundant? pastebin.com/vMT2H5Xt
 
Anonymous
moins
 
morning
 
morgen jayster
!!man nice
 
[ nice -- execute a utility at an altered scheduling priority ] nice [ -n increment ] utility [ argument ... ]
 
Wes
8:15 AM
@Alesana yes but consider doing the private methods public if it makes sense doing so, in some other service perhaps
 
!!wotd
 
dinkum: genuine; authentic.
 
Wes
anyway that method didn't look very long, i actually meant very long methods, like 50+ lines :B
 
moin
 
Wes
\o
 
8:17 AM
o/
 
@Alesana consider injecting $dbh and repositories which helps you retrieving data like getUserDetails etc.
@Wes very long methods IMO are 100+ and huge 500+
 
Well in my example it wasn't because I took all the boring parts out, altogether before splitting it up the method was ~130 lines
And I wasn't finished with it either haha
 
Wes
oh yeah i would definitely split that method into smaller chunks... if you can, try to make smaller public methods out of it, but don't do that prematurely... be sure you actually need public stuff. otherwise a bunch of protected/private methods is ok imho
 
Forget about the practicalities of how for a second and think about why short methods are better @Alesana
 
R.P
As usually database layer is the same, then isn't Repository pattern better? In this case You could have AbstractRepository which for example has database adapter injected.
as fetchall, prepare, execute is always the same for that $dbh
 
8:22 AM
@brzuchal Ah those query other classes which use a separate DB
 
If you don't know why you are doing something, you can't know whether you are doing it correctly.
 
Wes
the problem of long methods is reading them as a single unit, like you have to scroll 100 lines up just to see what a variable is, then scroll back down to what you were reading, you have the problem of accidentally reusing the same variable name for multiple uses, etc
 
@DaveRandom Hmm, good point. Is it because it makes it easier for testing and debugging?
 
Think of it like a book you are reading
If a page is one huge sentence with no periods or paragraph breaks, that's pretty hard to comprehend
 
8:24 AM
Ahh that would make sense
 
Short methods do help testability but really that is also about code comprehension
 
And here I was thinking that the only reason I would ever split something up into it's own method is if it were to be used by more than one method
 
it's about breaking it up into discreet units of work
And sure, sometimes you do end up with a really long method that can't be broken up - sometimes a complex idea takes a complex "explanation" (going back to the text analogy)
 
Ha I don't even want to look at code I was writing 6 months ago
 
But if you look at a line of code, or a group of lines of code, and you can describe it in a way that reads easier than the code itself, that is a unit that can be broken out
It doesn't always make sense, and this is an extremely purist theoretical thing
 
8:28 AM
Yeah it would definitely make it easier if I had started out doing my project like that
 
dammit that "discreet" typo is just hanging there in my face like a bad smell :-/
 
Yeah if I hadn't broken my method up into smaller chunks it would have been ~300 lines
 
as another rule of thumb: when you are describing what a method does and you have to use and then it's a sign you might want to split that in two methods instead.
not an absolute rule, but a good heuristic
 
Yeah, a good indicator. Makes sense. It's like, a run-on sentence
Yeah, a good indicator and it makes sense and it's like a run-on sentence.
 
8:49 AM
Hello
all
I am able to get notification in my app
but how can i give it to web
like this
 
When laughing gas gets lost in translation... #Thailand https://t.co/7kfKzGBP5G
 
@DaveRandom
 
@AdityaVyas-Lakhan don't ping randomly!
Better to ask your question in JS room
 
That ^ and also that question is way too vague to even begin to answer
 
ok thanks
 
Anonymous
8:52 AM
your face is vague.
 
Wes
NSFW open at your own risk twitter.com/Shitty_Future/status/856787665366200320 #shittyfuture
 
:P
 
@Wes wtaf
 
Anonymous
is it actually nsfw?
 
Depends on your job I guess :P
 
8:53 AM
It's quite nsfw
 
:P
 
Pretty much nothing nsf my work but others likely will have issues
 
@Wes realdoll is working on ai powered robots if you are interested in that. they have mostly sfw videos on that on their website
 
That doesn't sound end-of-daysish at all.
 
Oh my god they use real human hair
 
Wes
8:57 AM
twitter.com/Shitty_Future lots of crazy stuff here too, also NSFW (some of them)
 
Wes
twitter.com/Shitty_Future/status/838850355232444416 AHAHHAHA this one is safe for work
 
Old but I do enjoy it every time :-P
 
@Wes lol
 
Anonymous
9:09 AM
:P
 
Wes
["parent", "bar"](); didn't that work?
seems parent::bar() is the only way to call a parent method, right? good
 
parent::class?
 
His parents clearly have no class
 
!!lxr inflateValidate
 
@Danack Nothing went wrong but I couldn't find a suitable definition
 
Anonymous
9:15 AM
he's so defensive
 
That does seem to be an issue, it complains that you are calling it statically
@Wes why would you do that though? What's the use case for dynamically calling a parent method like that?
 
@PeeHaa oh_snap.gif
 
Both of those should work though, probably
(new ReflectionClass(parent::class))->getMethod('bar')->getClosure($this)() works as expected @Wes, pretty horrid though
 
Wes
@DaveRandom none. but searching for possible syntaxes. i want to see stuff like call_user_func die quickly :B
 
No chance before 8 at the earliest
@Wes I think your example should have worked though, I consider the fact that it doesn't a bug. An edge case, but a bug nonetheless.
('parent::bar')() should work as well (also doesn't, I checked)
 
Wes
9:27 AM
i'm good with that :B
@DaveRandom these 2 both work tho
$p = ["parent", "bar"];
$p = "parent::bar";
call_user_func($p);
if you do with () it doesn't
 
I imagine there's an existing bug report but if there isn't you should make one
 
Wes
for what
 
For that face of yours
 
"Inconsistent scope resolution behaviour for call_user_func(_array) and direct invocation"
 
Wes
that's a feature request @PeeHaa
@DaveRandom they must die them all, except closures
 
9:32 AM
I definitely disagree with that
 
Wes
why
 
$target = [$obj, $cond ? 'someMethod' : 'someOtherMethod']
 
Wes
$target = Closure::fromCallable([$obj, $cond ? 'someMethod' : 'someOtherMethod'])
 
Unless there is a way to do $target = $cond ? $obj->someMethod : $obj->someOtherMethod
@Wes messy. Shouldn't be coupled to Closure
need first-class support or nothing (imho)
otherwise it's just replacing one mess with another
 
Wes
closures are the only thing that makes sense
callables are crap
 
9:35 AM
Closures are an implementation detail
39 secs ago, by DaveRandom
need first-class support or nothing (imho)
 
s/nothing/no change/
 
Wes
done and done
 
No, need native first-class support. A pre-requisite for that is merging the symbol tables. You want to work on something people will fight tooth and nail (as they will with what you suggest), work on that
(imho, obv)
 
Wes
you have that effect if you use that lib correctly, ie, avoiding using the same name for different things
 
9:39 AM
You also have a fucking huge performance hit which could be avoided at, from my PoV, very low cost if you just fix the language so that the lib is unnecessary
Both options would be equally difficult to get through, may as well do the one that actually fixes the problem instead of hiding it in a different way
 
Wes
the slow part of that lib is the instantiation of the reflection objects, but i planned caching them
levi and i actually wanted to write that rfc... it would have started with a notice/strict standard "using the same name for both a method and a property is deprecated"
cc @PeeHaa
 
@Wes This we should do as soon as possible
 
Wes
also ocramius was pro it
 
@Wes DO IT
 
Same goes for class/constant/function names
 
9:42 AM
NOAWW
 
Wes
surprisingly...
@LeviMorrison let's do it...
 
You have my vote already, and several others. I have spoken to a lot of people about this problem over the years and almost no-one has been against it
 
Wes
@JoeWatkins @bwoebi @NikiC @ircmaxell @Gordon would you support that? we didn't do it because we thought the vast majority would disagree
 
(prediction) Joe wont be a fan -0.5. Bob hates everything -1. Niki won't really care +0. Anthony I don't know, probably +0.5, Gordon +1.
:-P
 
support what?!
 
9:48 AM
@Gordon Merging the symbol tables
intially with E_DEPRECATED for class members named the same
 
I have no clue what that would result in.
if it means I cannot use the same name for a method and a property I am not in favor as I see no reason why the language should prohibit this
 
Well for me the chief benefit is that it would allow you to have first class method references, and invoke properties that store callables directly
But also general sanity
 
I'd like first class method references but not at the expense of not being able to name a property like a method
 
Well I don't understand that but fine :-P
 
Wes
@Gordon in 10+ years of code the only thing i had was $count and count()
the impact is minimal imho
 
9:55 AM
count would already be too much of a break
also, there is people using foo($val = null) { combined getter/setter for $this->foo }
 
Wes
you will have time up to PHP8 to fix that. fields are 99.99999% private, which means you can rename it without impacting anything else but the class $count is in
 
I dont want to fix that. I don't see any reason why the language should prohibit this.
 
Wes
this is why my enthusiasm faded away almost immediately :B
also danack i think would support it
 
3 messages moved to Trash
 
@Gordon These are all easily fixable with tooling
 
10:07 AM
@Gordon They got what they deserve :P
ducks
 
Wes
^ :D
 
Doesn't JS magically and silently prefer properties over methods ?
I think it does
Cannot be bothered to check though :)
 
Wes
properties and methods are the same thing in js @PeeHaa
a method is a property set to a Function instance
 
oh right
yeah
 
Most languages with objects have that behaviour afaik
 
10:12 AM
@Gordon can you point out the languages have first class method references, that also allow properties/methods to have the same names? (i don't know, but would like to see how they differentiate the two).
public function toArray()
{
    $data = [];
    foreach ($this as $key => $value) {
        $data[$key] = $value;
    }
    return $data;
}
Is there a 'better' way of doing that? for uncertain values of 'better'.
 
return get_object_vars($this);
I think that has identical behaviour
(unless the class implements Traversable)
 
There is always a way to complicate life - using (ReflectionObject($obj))->getProperties() then ->getName() and ->getValue() ;D
 
Wes
groovy has, it sux imo:
$this->property
$this->&method
 
@DaveRandom ta
 
Wes
methods are referenced with &
 
10:17 AM
I'm not a fan of that but would accept it if it was the only option
 
Wes
did java 8 get that too? @Gordon
 
AFAIK Java behaves like JS properties and methods cannot share name
 
Wes
no, java behaves like php
or rather, php behaves like java :B
 
Hi. Is there any trick to use newer version of PHP's SQLite libraries, if I don't have root access?
 
@Laotse no
 
10:19 AM
:(
 
Might be a userland impl but it will likely be slower
 
Get yourself a proper machine with access or a proper system admin
 
I have though shell access, so if I compile sqlite executable for Linux, is there any way to use it?
 
XY: why do you need a newer version? What's the thing that you need to do that you can't?
Also, what's you current PHP/sqlite versions?
 
Yes, I need at least 3.9 version for indides with expressions
 
10:22 AM
indices with expressions? What does that mean?
 
Current PHP 5.6.30, SQLite 3.8.10.2
 
@Laotse Prediction of your near future:
 
Looks familiar in the present also
 
Wes
@Danack omg this is me every single day of my life
 
@Danack I really liked that show
 
Wes
10:25 AM
i've kind of ignored it when it was new... i wonder how it'll look like if i watch it in 2017 :B
 
@DaveRandom What do you mean by userland implementation?
 
@Laotse OK this seems like a reasonable and legit requirement, and one that you are not going to be able to solve without a better host and/or getting a sysadmin to do it for you. Sorry :-(
@Laotse One written in pure PHP (no extension)
 
Is there any available?
 
@DaveRandom I want to say "use a proper dbms"
 
There is that also, but I think people in general don't use sqlite without a good reason
 
10:29 AM
@DaveRandom They are masochist and doing mysql is just not rancid enough
 
@Laotse can't find any with a quick search, sorry. A lot of googling might turn something up, dunno.
@PeeHaa There are some ways in which sqlite is less retarded than MySQL (index on expr is a good example)
 
Ok. This is a small but annoying problem. Might switch to Mysql, but it would be a lot easier in my case to use SQLite
 
postgres <3
If it's an option, you won't regret it
 
i am unlucky never used it :(
 
Quick accept that ^^ suggestion @Laotse before he starts throwing mssql at you
 
10:32 AM
Look, right, SQL Server is a good RDBMS. It's not suitable for basically any PHP application, but it's a fucking Rolls Royce compared to MySQL.
 
:)
 
See! Told you so!
 
I will fight you. I will fight you... and I will lose.
 
But nooooooo you uad to be slow and not accept postgres
 
My coworker is driving me crazy in code reviews... he wants a new value object for every value that is written to a log once instead of just using scalars (32 of them...)
/rant
 
10:34 AM
@DaveRandom That's not exactly fair now is it. You are a fucking 3 meters tall giant
 
Not my fault you are vertically retarded.
7
 
You are so tall you are no allowed near the airfield without a flashing light on your head
@DaveRandom hahahahahahhaahah
OMFG that is the most beautiful thing I have seen this year
 
you are 9 feet @DaveRandom ?
 
@Linus Yes and 11 toes on each one of them
 
Anonymous
@DaveRandom lol
 
10:36 AM
:P
 
Wes
look at this, it's new en.wikipedia.org/wiki/Metric_system they say it works
 
@DaveRandom I don't watch TV, I just know memes.
 
Wes
lol
 
php -S fail to handle correctly router and docroot relative path – #74496
 
10:52 AM
@DaveRandom I think you will be pretty right with that
And internals will reject it with a small simple majority (like 55% no)
 
Quick poll - which order is 'correct'?
 
Wes
x y, lat long
 
^ that
ok
Who voted wrong on that poll?
Come clean now and I might forgive you
 
Anonymous
I voted right. If that's what you're wondering
 
Wes
me too :B
 
Anonymous
11:03 AM
By right, I mean long lat.
 
wtf
28 mins ago, by DaveRandom
Not my fault you are vertically retarded.
 
Wes
dunno in english but long lat in italian sounds super strange :B
 
Anybody understands: .htaccess -> .htpasswd in an apache + fpm set up?
It does not work ™
 
@Wes but that's the opposite? unless x goes north-south?
 
Anonymous
@PeeHaa sounds like user error
 
11:06 AM
@JayIsTooCommon Does this mean you understand any of this stuff? :)
 
Anonymous
lol, no
 
damnitr
Anyway is somebody is smart enough to spot the mistake:
.htaccess
 
Wes
@Danack lat is parallel to the x line, i interpret it this way, but yeah you could interpret it the opposite :B not really an argument
 
AuthType Basic
AuthName "Password Protected Area"
AuthUserFile /var/www/vhosts/domain.com/www/.htpasswd
Require valid-user
.htpasswd
name:hashedpw
Why wouldn't that work? As in I don't get a basic auth prompt
 
Wes
AuthName "Password Protected Area"
AuthType Basic
AuthBasicProvider file
AuthUserFile "/var/www/vhosts/domain.com/www/.htpasswd"
Require valid-user
no idea what the problem is, but i have that in that order
 
11:10 AM
No dice
The header is never set
!!poop-on apache
 
Wes
<Directory "/">
AuthName "Password Protected Area"
AuthType Basic
AuthBasicProvider file
AuthUserFile "/var/www/vhosts/domain.com/www/.htpasswd"
Require valid-user
</Directory>
 
💩 on apache
 
500 :)
 
Wes
wat
that is exactly the one i am using, except mine is indented
 
Are you also running fpm?
 
Wes
11:12 AM
no
 
0
Q: How to adjust large string to next pdf page using multicell fpdf?

ExceptionI have following function which print comment over pdf page but if there is large text then it breaks and goes into the footer instead of next page. Here is the function- function printSectionComments (&$pdf, $section) { if(! $pdf->sections[$section["id"]]["commentsPrinted"]) { ...

 
I'm about to give up
 
Morning
 
yo @kelunik
 
Wes
@Danack did you buy a mouse with the back and forward buttons? :P
they are gold, and they work in phpstorm too (they do the same as the < > arrows in the toolbar)
 
11:19 AM
@Trowski So we can remove that recommendation against yielding in finally now?
 
youtube.com/watch?v=XU_rpMvFucs :p happens with me all time
 
I got on a bus, it went badly
also \o.0.2
 
@JoeWatkins Did you pass the canal yet?
:P
 
o/
 
I don't get it ... should I get it ?
 
11:25 AM
Was asking whether you arrived in NL yet
I assume you got on the wrong bus
 
Anonymous
@JoeWatkins ewww why ?
 
I had to use the smelly bus, I dropped car to have tow bar fitted ...
then didn't recognize my street and overshot home by about 10 miles ...
 
Anonymous
have you showered?
 
I've got to use it again in a while, so I'll just avoid close quarters contact with humans until after that ...
 
11:42 AM
@Danack I cant.
 
11:54 AM
hello, its not about php but do you know a way to track sql queries history with team
 
\o/ I get to leave france today
 
@Wes I did, but I deliberately don't use them, nor do I use complicated key combos, as that way gives me quite bad RSI.
@Leigh I know that feeling. France is nice......in theory.
 

« first day (2383 days earlier)      last day (2558 days later) »