« first day (2741 days earlier)      last day (2198 days later) » 

12:02 AM
this is a collection mapper. I'm about to add some conditional stuff to it, so that user permissions affect the actual list being returned. on a scale of laravel to 10, how shit is it?
 
while (list(x,y)=each(z)) fails after first loop – #76231
 
 
2 hours later…
2:54 AM
posted on April 17, 2018

New Cyanide and Happiness Comic

 
3:47 AM
@FélixGagnon-Grenier i mean... the theory isn't horrible, i'd give it a 50% shit rating
it could do with stricter typing and better separation of concerns imo
 
 
2 hours later…
5:30 AM
morning room
 
6:06 AM
@shadowhand typing of the conditions?
 
 
1 hour later…
7:07 AM
mornin
 
@bwoebi thx for the help. actually we need to cut the string in portions of 75bytes but take care that we dont cut a multibyte character between its bytes.
 
7:26 AM
@staabm preg_replace('/(.{1,75}(?![\x7f-\xff]))/',"$1\r\n", $string) so that's what you actually want?
but you'll still cut within grapheme clusters with that (you do too though with your naive mb_* approach)
 
morns
 
Wes
\o
 
7:41 AM
o/
 
but yeah my bad, my brain read that mb_strcut as mb_substr :-D @staabm
 
7:56 AM
@FélixGagnon-Grenier my main issue would be the new SomeEntity inside a mapper
 
@bwoebi isn't that never going to break on anything non-ascii?
 
omnishambles Chiefly British Informal. a situation, especially in politics, in which poor judgment results in disorder or chaos with potentially disastrous consequences.
 
bob
Hi, why does this only return one result from the database? pastebin.com/FTNwcnU1
 
@PaulCrovella well, if there are more than 75 continuous bytes with the high bit set, then it will fail - but then it's not valid utf-8 either
 
@bwoebi sure it is - all multibyte character have all their high bits set
(and by "character" here I mean utf-8 encoded code point)
 
8:10 AM
preg_replace('/(.{1,75}(?![\x80-\xbf]))/',"$1\r\n", $string) it is then \cc @staabm
@PaulCrovella yeah, it should still split if the next character is the start of an utf-8 character
you're right - not just highest bit must be set but second highest must not be set as well
 
if grapheme clusters are a concern grapheme_extract is probably the way to go.. though expect it to be slower
 
@PaulCrovella pcre has a nice escape sequence … \X
 
yeah, but counting bytes then is a little messy... a negative lookbehind with \C{76} or some shit maybe
 
> PCRE2 does not allow \C to appear in lookbehind assertions (described
below) in UTF-8 or UTF-16 modes, because this would make it impossible
to calculate the length of the lookbehind.
 
oh lame, well so much for that idea then
 
8:22 AM
but yeah, counting bytes with pcre is annoying
 
Wes
mdn ~= w3schools
things are getting worse rather than better
 
!!dad
 
What did the grape do when he got stepped on? He let out a little wine
 
@Wes how?
 
Wes
documentation on new stuff is a mess
 
8:35 AM
SoapClient Cookie Header Semicolon – #76232
 
if (intval($limit) > -1) {
    $this->offset = $offset . ', ' . $limit;
Nice SQLi in one of our production APIs
0) It was written by the guy who moved everything _to_ laravel
1) Fuck query builders
 
Wes
that looks like code i would write
 
I appreciate you starting that list at 0
 
@Wes It checks the sanitised value, then uses the unsanitised value when building the query
 
Wes
i confirm, that's totally me :B
 
8:39 AM
moin phomies
 
buenos dias mr Joe
 
\o
 
ThW
@Wes with quotes, xpath syntax is to complex
your could allow booth (for simple location paths), just like attribute css selectors
 
Wes
thanks, yeah i used quotes
still need to figure out how the property value is parsed
looks like it's very permissive with a few exceptions
 
@Leigh well, obviously laravel will protect against any sql injections, so your "worries" are just baseless accusations of an uneducated person
 
8:57 AM
travis has changed the order of jobs, I hate change, my life is over ...
 
Damm, PHP is rotten to the core, considering any lack of scopes, this is crazy!
 
huh?
there are several scopes in php
 
Morning 11
 
there is only one scope - function/method scope
 
Wes
but its main scope is ruining our lives
 
8:59 AM
and of course global scope where everything which is not in function/method scopes exists
 
php-cgi.exe crash (see small dump) – #76233
 
@Jeeves I was expecting 💩
 
@brzuchal there are function, class, global and static scopes ... and those are jsut the ones I can remember
 
@tereško yeah, and nothing with namespaces at all
 
so, what you are actually bitching about is that global scope variables are not split by namespace
 
9:02 AM
every variable initialized in namespace {} is global variable, same as every const using define()
yes
thats pretty sad
 
frankly, I don't give a fuck
 
@brzuchal you got to love some $var\in\namespaces ?! wtf no.
 
it in no way affects the quality of code
 
@brzuchal And if you are making variables in code like that, then there is something wrong with you.
 
Wes
${__NAMESPACE__ . "\\variable"} = 123;
in case you want to gain the hate of your coworkers
 
9:04 AM
@brzuchal so, when loading a file with include, we'd need to write $\included_var?
use variable $included_var; lol
@brzuchal and given that namespaces are compile time constructs, outside of global namespace ${"var"} !== $var
 
he just wan't to be programming in some other language
like Java or C#
 
essentially you seem angry the global variable are global variables, and constants are constants ...
it's difficult to understand where you're coming from ... nobody forced you to use global variables in any namespace ...
 
@brzuchal Welcome to my pain liiiiike 3 years ago :)
I have a half finished, no intention of finishing (i hate opcache) zend_namespace branch
Although I literally only intended it for function/class ownership, not vars
 
@bwoebi it could be simply not accessible outside namespace
@tereško I think it's true, but I won't be
And when I look at wiki.php.net/rfc#php_73 there is not much new features so in a few years nothing gonna change
few years it's creepy
I'm the one which will always complain
 
Anonymous
9:27 AM
mornin
 
\o
@Wes OMG this works :/
 
Wes
.... yes it does but i was being ironic
 
yeah I know
 
Wes
i have done that some times in order to avoid creating public static class fields
they are basically the same, i just avoided creating a class for the sole purpose of storing a static field
 
the difference is they cannot be unset
I mean static field in a class
 
Wes
9:38 AM
what?
you don't unset declared fields, you set them to null
 
HI guys
I have found one code where following line confused me..
is_array($url) || $url = parse_url($url);
 
why is offset value here a empty string? it should be 3 since i dont pass any parameters

function related_posts($offset = 3) {
var_dump($offset);
}
 
can someone elaborate, How this works?
 
@Rudolph how are you calling this?
 
its an action in wordpress
i add it to a hook
 
9:53 AM
 
nvm i think i know why
do_action is the culprit
do_action($tag, $arg = '')
 
Does anyone know of a package for doing spline interpolation in PHP?
 
@pmmaga can you please elaborate.Still not able to understand how it actually works.We have ternary operator in php.But this looks different.
 
@Exception read it like this: if $url is an array, don't do anything else and return true. otherwise, run the right side and return it. You are effectively short-circuiting that operation because true || whatever will always be true, so there is no need to evaluate the whatever part
the same way that false && whatever will also never run whatever because you already know the result of that &&
 
no if condition,no ternary operator.So I was confused..
thanks to elaborate it..
appreciate it
 
10:02 AM
yw!
 
Wes
10:31 AM
@kelunik @PeeHaa responsive tables i.imgur.com/x4tlsJM.gif thoughts on the readability?
 
10:55 AM
Oh .. I learned something. If you update your website regularly (i.e. every day once) and not randomly (i.e. one day twice and one day none), then your alexa rank will be reduced so fast.
 
11:11 AM
you probably encountered their manipulation-protection script
 
@Exception just ftr, don't do that. The main reason not to do that is the exact thing that you have just discovered - it's hard to read and doesn't actually do anything different than just using an if.
 
Wes
$url = is_array($url) : $url : parse_url($url);
 
@tereško Not sure manipulation-protection what kind of script is .. But I will do that update at different times of a day to tell them that updating happens by hand, not using a bot.
 
ಠ_ಠ
 
@Wes nah fam
 
11:29 AM
my virtual host address is http://example.com
i want to use ip address to access it in my browser. How can i do that?
 
bad log filtering with 'log_level' in php-fpm.conf – #76234
 
you can't
 
Wes
@Shafizadeh ranking lowers only when you remove contents, and especially if you break links
that's like the worst thing you can do
if you add contents then you should be fine
 
how to split and store as a array for these variable values($var_value = "101-picone.jpg,101-piceight.jpg,102-picsix.jpg";
) based on comma seperation
 
Sometimes I think that @Shafizadeh is the Starfire girl from that Old Teen Titans show. :P
 
11:35 AM
morgen
 
\o
@tereško I tried to look at some local merchant sites to get the stuff from my list, and everything was either twice as expensive or more as compared to amazon and newegg
 
I'm Jack's complete lack of surprise
 
I am certain that even with the shipping costs amazon and newegg will be a lot cheaper compared to these merchants
 
Good morning!
 
hello everyone
 
11:47 AM
\o
 
To the PHPStorm users in here. Does anyone know if there's a way to enable custom region comments for yml files?
or should I just split my config up in several files and shut up? :)
 
@Wes ah
@mega6382 why do you think so? :-)
 
childhood trauma, most likely
 
:P
 
@GNi33 You should just use a file format that isn'tlimiting and stupid :P
 
11:53 AM
but I like yml :/
what do you use for configuration files?
 
@GNi33 PHP files.
 
Anonymous
ewwww
 
36 mins ago, by Danack
ಠ_ಠ
 
Anonymous
yml++
 
No, you should be writing your config as an extension and compiling it
 
Anonymous
11:55 AM
amateurs
 
@Danack been there. I like yml a lot more than that
 
@GNi33 to be honest: php, yml and json files ... it depends
and not .ini or .xml files
 
That's your problem then.
 
yml provides no benefit whatsoever
Like none
Nothing
Nada
Niks
 
It lets you pretend you're cool like the python kids
 
11:58 AM
other than cleaner syntax when being compared to php
no extra characters that I don't care about in a configuration
 
How is it cleaner?
 
@PeeHaa it looks more compact and you can add comments
 
Wes
@PeeHaa but you get to be loved by @Jimbo
 
@tereško php also allows comments
 
Anonymous
i like it's simplicity too
 
11:59 AM
And on top of that allows a lot more
 
Anonymous
But also trying to impress @Jimbo
 
@PeeHaa but it does not look compact ... or even all that readable
 
@JayIsTooCommon But it's not fucking simple.
 
Anonymous
language, you sound like @tereško
 

« first day (2741 days earlier)      last day (2198 days later) »