« first day (2168 days earlier)      last day (2763 days later) » 

1:01 PM
ok I read some
 
same, I don't think it adds any value.
 
@Leigh Which one?
 
strict_comparisons, in general
 
Would writing while($data = array_pop($array)) be legit?
Or would that throw a warning when $array can't pop no more.
 
I dislike assignments in comparisons
 
1:07 PM
> Return Values
>
> Returns the last value of array. If array is empty (or is not an array), NULL will be returned.
s'all good.
 
@Leigh there's at least one place where it would be good to have:
$initialValue = "2bananas";

for ($x=$initialValue ; $x<10; $x++) {
    echo "$x\n";
}
 
It's not for proper stuff, just hacking together a terrible AI.
 
2bananas
2bananat
2bananau
2bananav
2bananaw
2bananax
2bananay
2bananaz
2bananba
2bananbb
2bananbc
2bananbd
2bananbe
2bananbf
2bananbg
2bananbh
2bananbi
2bananbj
etc.
 
@Danack but your function would be typed as int $initialValue :P
I can't think of any non-contrived example where it would give a benefit.
 
@Sean the normal way to indicate that the assignment is to use additional set of ()'s
while(($data = array_pop($array)))
 
1:09 PM
What's wrong with while ($array) { $data = array_pop($array);
 
also works.
 
@Leigh Nothing at all, think I'll use that instead ^^ Thanks
 
but for things like:
while (($row = $statement->fetch()) { ... }
I'm not aware of an alternative.
 
OK @Saitama I added another example client/server pair
 
hmm, checking it out ;-)
 
1:12 PM
@Danack I don't think that's a thing in php
 
Wes
i'm hungry
 
!!dad
 
What does an annoying pepper do? It get’s jalapeño face
 
@Danack $row = $stmt->fetch(); while ($row) { ...; $row = $stmt->fetch(); }
 
dammit, random_int()!
 
1:12 PM
@Wes drink some coffee
 
@NikiC turns out my addition regex is buggy with jit=0 …
 
@DaveRandom what's up?
 
@bwoebi :D
 
@Leigh It didn't choose the right dad joke for the context!
 
What's fails?
 
1:13 PM
@NikiC it seems to consume a byte twice according to regex debugger on regex101.com … 100 + 101 = 1001
 
Wes
@Saitama i'm hungryyyy
 
@Leigh yeah....no. IMO, you're duplicating lines, just to avoid a style issue.
 
See around step 204 in debugger (i.e. when it executes (?=(?<cr>1)?))
 
@Wes there you go a hd hamburger
 
@Danack Nothing wrong with duplicating a line to avoid a lack of style issue :P
 
Wes
1:15 PM
beautiful
 
@NikiC it's not a php thing.....but some code analysis tools (aka the ones I use), will report a ($foo = bar()) as a potential error, but will not report (($foo = bar()))
 
@Danack stupid tools
 
Stupid tools - doing exactly what I want them to do....
 
@DaveRandom cheers \o/ works like a charm... Now I just gotta implement it in the server to so some stupid IPCs!! thanks for the help!!
 
@Danack stupid configuration, sorry
 
1:18 PM
@Danack Ok, better alternative: foreach ($stmt as $row) :)
 
ugh - foreachable objects that aren't just containers....
 
Wes
traverse all the things
 
@Wes that is exactly the problem.
 
Wes
ya
 
you could iterate over fetchAll() if that makes you happier
 
1:21 PM
@Danack perfectly fine
 
@Leigh I'm happy already.....it's not me wanting to avoid the style issue.
 
I'm happy too, because I already avoid the style issue. Hooray, everyone is happy.
 
...
 
> U+D83D is not a valid unicode character.
 
Wes
1:25 PM
@PeeHaa don't u know unigoode
 
@PeeHaa it's a lie. They sent it to everyone
 
Please can I have your suggestions of the one book that aspiring software developers should read?
answers on a postcard please
 
@katiegallagher https://www.amazon.co.uk/Pragmatic-Programmer-Andrew-Hunt/dp/020161622X the only thing wrong with this book is that I didn't read it early enough.
 
@NikiC Looks like a real bug in libpcre :-( I've just locally pulled the last version from SVN, built PHP against it and bug still present…
@NikiC Can you please check for sure whether it's a bug in JIT or non-JIT mode?
 
I'll take a look
 
1:40 PM
   The  only  unsupported  pattern items are \C (match a single data unit)
   when running in a UTF mode, and a callout immediately before an  asser-
   tion condition in a conditional group.
from pcre.txt
 
Fun-fact - using the doctrine constants like Type::STRING instead of \PDO::PARAM_STR for $queryBuilder->createNamedParameter(...) works for most, but not all, types.
 
and that's not the case AFAIK … so should not differ in results
 
@bwoebi which step is it again?
 
27 mins ago, by bwoebi
See around step 204 in debugger (i.e. when it executes (?=(?<cr>1)?))
 
@bwoebi What's the exact input to get that?
 
1:45 PM
31 mins ago, by bwoebi
@NikiC it seems to consume a byte twice according to regex debugger on regex101.com … 100 + 101 = 1001
 
For just 100 + 101 = 1001 that's not what step 204 does
 
@NikiC uh, sec
 
@Danack it's a utf-16 high surrogate followed by a low surrogate, use 0x10000 + (($high & 0x03ff) << 10) + ($low & 0x03ff); on their integer values in order to get the proper codepoint number
 
@NikiC Step 185 [if that's the whole input] … (I had it in middle of the big input with leading "+ " … thus …)
 
@PaulCrovella nerd
 
1:48 PM
what's the best way to do this:
 
@bwoebi I don't see what is supposed to be wrong there
It looks right to me?
 
@NikiC well, the cursor is currently after 100 + 1
Then it sets cr…
 
@bwoebi does it? where do you see what it sets?
 
even though the next char is a 0? @NikiC
 
You mean that there is no BACKTRACK message (when it matches for the 1)?
 
1:51 PM
@NikiC that, and later on it goes into a branch where (?(cr) …)
 
is there a function to check if an array has a value other than null?
isset()?
or just foreach ($array as $item) { if($item == NULL) { ... } }?
 
@NikiC i.e. step 258
 
@Tiffany what are you actually doing?
 
@PeeHaa in case you're curious, it translates to: Get more 💥📈
 
@bwoebi hm yeah, that does not look right
 
1:56 PM
@PaulCrovella I'm on chrome so I have no idea what that first thing is
sun?
 
@PaulCrovella yeah......I'm beginning to seriously dislike people using emojis as a form of communication.
 
@daverandom I have an array, $error_msgs[] that receives data from functions, validate_required_text, validate_required_checkbox, validate_required_radio_button as return values. It's receiving NULL when the form data is valid. I can either change my conditional to account for the NULL values in the array, or I can return an empty string? or something?
Optimally, I'd like the array to be empty, but I'm not sure how to do that.
 
unless (?<x>y)? has some weird semantics
 
@Danack beginning?
 
1:57 PM
no idea what it is trying to tell me
omfg
 
@NikiC (?:1(?<cr>))? exposes same behavior … and this very much should definitely backtrack upon reaching 1
 
@Tiffany why are you creating a record in the array at all on success?
 
@DaveRandom I don't know.
 
:-P
Just fix that :-)
 
If you use emojis in messages you are a fucking idiot and should die in a fire
 
1:58 PM
I was getting rid of global $error_msgs; from my functions. But I'm honestly not sure how to work around it. >.<
dear god I'm a terrible programmer
I can't figure out something so simple
 
@PeeHaa agree ☺
 
@Tiffany probably, but according to SO's user registration stats, you shouldnt worry about that
 
@PeeHaa 👍
 
@Tiffany Can you show the larger code in a gist, for context?
 
@DaveRandom sure
@tereško user registration stats?
 
2:01 PM
 
@Tiffany actually you will have to wait half an hour or so, I have to go get my son from school, but if you gist the code I'll take a look when I get back
 
sure
@tereško I'm at 38. My reputation only changes when I have a question, and depending on how dumb the question is. Are you meaning that because my rep is low, I shouldn't worry about being terrible, and just focus on improving?
 
yes
 
fair enough
 
@Tiffany note nr.1: you should keep the field name with the error that it produced
 
2:07 PM
@tereško I'm not following. Add the form elements that would produce the error?
 
$errors =  [
    'name' => ['empty', 'duplicate'],
    'email_field' => ['invalid'],
];
you want to be able to "bind back" the error to the field in which error occurred
if for no other reason then just to add the red border on the input
 
ahhh
that makes sense
could I return $error, $name, and have both append to the array?
 
same field can have multiple errors
 
true
 
and since field names should be unique-ish, I would recommend using the field name as a array key
 
I haven't written any functions for custom checks because they've been obscure. Though I suppose I'd be better off writing an error function that does different checks, based on arguments?
 
untested but you get the idea
 
thanks, yeah, that does make sense
 
@DaveRandom that might cause some issues, since you are concatenating the function name
(I know it is a valid approach .. I just never have liked it, even though I tend to use it myself)
 
I figured making multiple calls to the functions was suboptimal, but couldn't think of a way to make it better.
and I didn't want to get caught into optimization hell
Another question: I notice both of you have a comma before the closing of the array. Isn't that incorrect?
I mean, I can understand the VALUE of having the comma at the end, it makes it easier for humans. But, I thought the language couldn't handle that?
 
2:19 PM
@Tiffany it works
the reason why we add extra comma is the have less lines altered in git diff
 
ahhh
 
doesnt work in JS
 
maybe it's javascript that it doesn't work shrug
lol
I wasn't scrolled down when you said that :P
 
@NikiC compare regex101.com/r/vY0eC8/3 and regex101.com/r/cM6iN2/2 … the latter one is really just putting the second line in a DEFINE and calling it then
Are there any capturing group recursion semantics I'm missing?
 
Could somebody explain to me what he/she/it/towel means with this?
@PeeHaa Pieter, can't you comment all that stuff in just one comment? ;) — dbf 31 mins ago
#HonestQuestion
 
2:29 PM
dunno…
 
@bwoebi interesting
 
¯\_(ツ)_/¯
 
I'd suggest just reporting that bug and see what happens...
 
@NikiC Also weird: regex101.com/r/cM6iN2/3 … commenting out the assertion (before the recursion call) affects the result (i.e. prepend a # to the penultimate line)
 
Wes
@PeeHaa there's also a Phiter
 
2:33 PM
@NikiC I'm going to…
 
@PeeHaa he meant couldn't you have just used one comment, rather than putting each question in a separate comment.....aka noise.
 
@Danack But I asked the question and OP edited his answer. Without fixing what I asked
It started out with this stackoverflow.com/revisions/39638094/1
But it looks like it was not related to escaping anything at all from the looks of the last edit. SO I have my answer now :P
 
You could have told him to comment something useful next time
 
@DaveRandom thanks, that worked. :) I had to alter the array shorthand, since I'm on PHP 5.3 :x but otherwise it worked.
 
@tereško agree on all counts
@Tiffany cool, just beware that dynamic function calls like that pose some security risks. What I did there is OK because it's just constant strings defined in the code, but NEVER call a function based on user input
 
2:44 PM
Looking for some support setting up PHPoAuthLib if anyone may be available and could spare a bit of time?
 
i.e. don't do something like $func = 'get_' . $_POST['foo']; $func();
 
yeah, that makes sense.
I follow the mantra "don't trust user input"
 
> The reason I'm using references is because I'm using Guzzle Promises where I unwrap the variable and therefore have to use the reference.
 
@Danack That's a question somewhere on main right?
I think I have seen something like that today
 
evening room
 
2:52 PM
o_
 
_o
 
|
o
 
incoming jizz penis in 3... 2...
hmmm @DaveRandom is actually working I think
 
nope, I am actually playing splix.io with a 5yo
 
or picking up his kid
 
2:55 PM
@DaveRandom I had a game like that on my gameboy I think
 
@PeeHaa reddit....I'm really too scared to want to know more.
 
@Danack Oh rite. I have seen it over there
 
Wes
@DaveRandom i don't get how the hell it works :\
i get spawned in and killed almost immediately by someone running in my area
 
Anonymous
> Will be happy to post the code if that will help identify what's the problem Is
 
Anonymous
3:04 PM
no. shit.
 
@Wes when you join the line back to your area, it fills the blocks in the middle. Don't let someone hit the line.
it's that simple
 
@JayIsTooCommon unnecessary, I've already determined where the problem is
 
Anonymous
@PaulCrovella php bug.
 
If you hit your line, its game over.
 
Anonymous
3:06 PM
@PeeHaa oi, how's the game going?
 
Did some twitter fixes first. Trying to spread out my love over projects
 
Wes
Last game: killed by justinb
 
Anonymous
groosssss
 
Wes
got killed by justin bieber
 
Anonymous
blaspheme
 
Wes
3:08 PM
FFFFFFFFFFFFFFFFFF
killed by yourself
wish i did in real life
 
Yeah same here
:P
 
Anonymous
I'm not following any of this O.o - are we praising JB ?
 
Anonymous
oh wow, they actually have sent me a job offer.. What a weird company
 
Sounds like their last developer left in a hurry
 
Anonymous
Yeah maybe, place of work is awesome though but ehhhh
 
3:14 PM
> Kindly help, as this is important!
Yea, I'll get right on that.
Do people actually think that if they put "urgent" and "important" in the questions that people will suddenly be more inclined to answer it?
 
Wes
nooooooooooooooooooooooooooooo #18 :(
i don't get what happens when my trail is overlapping my own boxes @DaveRandom
 
@Wes nothing
 
bowing down Sir, you are a god amonst men. This regex is a work of sublime beauty. — Sebastian Lenartowicz 20 secs ago
uuuuuuuuh.
 
lol
 
@bwoebi You're a God amonst men dude.
 
3:24 PM
hahaha
 
But, I mean, for all we know you're just another Watson.
Your profile picture is suspiciously very bot-like...
 
@JayIsTooCommon What kind of stuff do they do?
 
Looks like something a computer would have come up with :p
 
Anonymous
@PeeHaa tell you tonight if you're on
 
k
 
Anonymous
3:26 PM
Add another k please.
 
But don't add two, then you'll be a racist.
 
Anonymous
xD
 
kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
 
Anonymous
Sexist.
 
@Sherif I'm just a machine which intentionally fails the turing test if you're testing it…
 
3:28 PM
@bwoebi You're one dumb machine then.
 
> This caused regressions in Prophecy for code that worked fine on PHP 7.0 - there's no compelling reason for getType to return a string with ? when there is no ? in the source code
I can understand people's logic here but it's just flawed. A default of null implies that it is nullable.
It's just that previously we didn't have a way to encode it.
 
You know what the best Turing test is these days? Just get a troll to talk to it. If it's outraged easily it's human. If it ignores you it's human. Any other response... it's a bot.
 
@Sherif Wrong. A clever human is trolling the troll.
 
@bwoebi We've reached the halting problem.
 
@LeviMorrison We've discussed this before, so need to go hash it out again in depth, but people do want to be able to run a code analyzer with PHP 7.2 and have it analyze (and regenerate) code that is designed for PHP <7.2. Having it suddenly start having a ? in it is a problem for them.
 
3:32 PM
or it's reddit and tries to get the troll elected
 
hehehe
 
@Danack This isn't specific to getType().
They are talking more generally that Foo $foo = null is not ?Foo $foo = null which is untrue.
I get the BC break.
These same people are not seeing that Foo $foo = null implies ?Foo $foo = null which was included in the nullable types RFC.
They see allowsNull() as being insufficient to generate ? or not (which is true) but they are missing the point: Foo $foo = null allows null. It's a nullable type.
Whether they print the ? is up to them based on the version of PHP they are targeting.
The reality is that it is a nullable type.
 
OMG, a fortran question?! You only ever see one of those a week or something. Time to open that 25 year old bottle of bourbon.
 
Noooo it's gone
@Oldskool What did you say you dick
:-)
 
@Jimbo What do you think I said? ;-)
Or more importantly, about who did I say it? :-P
Anyway, I misread something... my attention span has reached it's end for today.
So it was no longer relevant.
 
3:40 PM
my code is quickly turning into spaghetti
this is horrible
 
@Tiffany Add some meatballs and you got yourself a nice meal.
 
I am getting hungry
 
@Tiffany At least you see it happening. That's your time to stop and refactor your stuff first.
 
Or Chicken.
 
anyone here recommend a release notes generator for github projects? I've found this but would prefer to stay as free of ruby as I can
 
3:42 PM
@Oldskool problem is, I'm not sure how I can fix it so it's not spaghetti. at this point I just want to finish it and see if there are ways I can optimize it when I'm complete. Sure, I'm wasting time, but inexperience is getting the better of me.
 
Anonymous
@Tiffany I would actually recommend that while learning. Constantly re-doing stuff is a good way to learn imo
 
@JayIsTooCommon I don't disagree but I've spent far too much time on this already. Saying that I would have it done by next week "was too long"
I'm only allowed to program in small amounts :( so I rarely have the opportunity at work to improve.
 
3:58 PM
Uhm @NikiC somehow we got sidetracked by the PCRE thing … Do you remember what the actual problems with my HashDos patch were?
 
Wes
@JayIsTooCommon eh. not sure about that. after i rewrite the code several times i start wishing everything and everyone related to it explodes in a huge fireball so i don't have to touch it again
 
Anonymous
hehe each to their own :P
 
head->desk();
Encountered a bug with the third-party vendor API and my code. ... I think it's lunch time. Spaghetti sounds good.
 
@bwoebi I don't remember if there were any specific problems, I'd have to review again
 
@NikiC please do.
 
4:06 PM
iirc some parts were pretty fragile (in particular input vars parsing I think)
but I don't think there were any fundamental problems
 
@NikiC if it's individual things, they can be fixed, I guess.
 
there's a couple failures on travis
we gotta be careful that we don't fix hashdos by introducing rce or something :D
(which is what happened the last time around...)
 
@NikiC did it? How does HashDos prevention trigger rce? O_O
 
@bwoebi the max_input_vars implementation was buggy
some dangling pointer left somewhere if it triggered in certain circumstances
 
@NikiC yeah, I'd have to merge master in and fix it … the main question is whether the approach could be fine
 
4:14 PM
@Ocramius Question about things like zend-code before 7.0; were you using something like preg_match('/\[\s\<\w+?>\s([\w]+)/s', $ReflectionParameter->__toString(), $matches)?
 
@Saitama figured this might be of interest to you if you hadn't seen it already: github.com/soruly/whatanime.ga
 
@bwoebi well, obviously I consider it fine
it's the same thing I originally proposed with s/fatal/exception, which is of course better
 
@NikiC So, what are the remaining issues? Internals?
 
of course our other experts on hashdos may tell you that this is not a proper fix and just a workaround or whatever
 
Do you have a strategy do make them shut up? Let Dmitry review it and have Joe approve it and merge straight ahead?
 
4:18 PM
@PaulCrovella I haven't used it, but remembered keepachangelog.com/en/0.3.0
 
@Leigh :O thanks for the link!
 
@Danack that's not a generator, just some guidelines
 
@bwoebi No, Dmitry will have a problem with it
Let Stas approve it and merge as a security fix.
 
@NikiC He will? Why?
 
is it good to define constants into classes? Should I define it outside?
 
4:24 PM
@Leigh tho most of the times, it doesn't work :/
 
@Saitama I didn't try it, I just saw it on github.com/trending for PHP
 
sou ka
 
@NikiC Good, I'm looking into fixing it today or tomorrow then, based on 7.0 branch.
 
apparently some chinese framework is very popular at the moment :p
 
@bwoebi See "Better HashDos protection" thread
 
4:25 PM
lol
 
> Your addition, just changes fatal errors into exception, that doesn't change the core problem of the approach.
Ah
 
@bwoebi I'd go for 7.1. With exceptions it becomes a pretty intrusive patch (as in: requiring changes to many different parts of the codebase)
I'd suggest deploying to 7.1 first and if everything is well do a backport
 
@NikiC That's fine to me too
 
If using something like RabbitMQ and you just deployed your application and now need to run multiple listeners is there are a better approach than php listener1.php php listener2.php etc
 
4:31 PM
@tibanez why do you need multiple listeners? can't a single listener subscribe to multiple queues?
 
1 + 2 + 3 = 4??? Where did you learn math? — Sherif 55 secs ago
You can't make this stuff up.
 
@Sherif that's an advanced level of stupidness
 
@Saitama Strange times we live in.
 
true dat
 
4:56 PM
@Leigh How would that work though when they are all listening for different events?
@Leigh Oh I think I get you
 
5:19 PM
@Sherif That's just a typical brainfart. Nothing special.
 
@bwoebi So it turns out... At first I thought it was some serious mental deficiency.
 
Tztztz, don't always assume the worst of people :-D
 
hey fellas super noob started learning PHP today quickie
<?php
$languages = array("HTML/CSS", "JavaScript", "PHP", "Python", "Ruby");
var_dump($languages);
<br>
print_r(array_values($languages));
?>
obviosuly the break tag doesnt work whats the equivelent of this? to seperate the two outputs?
 
@bwoebi What? I don't assume the worst you blithering fool! How dare you assume that I assume the worst?!
:p
 
:p
 
5:24 PM
You ever have that feeling every time you compile like... you're playing a game of Russian Roulette?
 
is there any other way to redirect to a page other than using header()?
yes
 
Will it compile? Will it blow up? Who knows!
 
is this correct syntax or is there a better way to do this?
<?php
$languages = array("HTML/CSS", "JavaScript", "PHP", "Python", "Ruby");
var_dump($languages);
echo "<br>";
print_r(array_values($languages));
?>
 
yes
 
5:28 PM
Is that the right way to separate outputs?
@Saitama Thank you!
 
well if you are building web-apps yes... other wise if you are building cli application you need to echo out a new line like - echo PHP_EOL;
 
@Saitama Thank you good to know!
What's the best resource for PHP best practices, Because I know it's really easy to write bad PHP I'd rather try to avoid that from the get go?
 
@BlunderCode are you looking for free options, or do you have money to spend?
 
@BlunderCode As opposed to it's harder to write bad code in any other language?
 
i.e. books and shit
 
5:39 PM
@Tiffany I have money and don't mind spending it as long as its worth it. Just a good do's and don'ts i.e it may be tempting to do ___ but don't because of ___. I know this comes with time but anywhere with protips would be cool.
@Sherif You know what I mean haha
 
@BlunderCode SitePoint has some good stuff, I enjoy Apress as a publisher, but haven't read any PHP books they've released. amazon.com/gp/product/B00BCQ5Q96 is something I bought recently, but haven't dived too far in. Another one I'm looking at getting when I can spare the money is amazon.com/Modern-PHP-Features-Good-Practices-ebook/dp/…
 
This looks solid same guy that wrote the last book phptherightway.com
 
PHP isn't too special. I'm with @Sherif in that having a good foundation in writing code, is better than knowing best practices in a particular language.
speaking of bad code, I need some help restructuring something.
 
@Tiffany I'm moving from a JS Stack-based background so the coding isn't the hard part just making sure I'm doing it right is haha
 
@BlunderCode the part I continue to struggle with is the use of -> and => in PHP. I THINK I've gotten the hang of it, now, but I know if I'm away from php for a couple weeks and come back, I'll have to google them again.
 
5:55 PM
@Tiffany Googling them as we speak
 

« first day (2168 days earlier)      last day (2763 days later) »