« first day (1818 days earlier)      last day (3356 days later) » 

16:00
A great expert question, for example, would be "What are the technical differences between 301, 302, and 307 redirects, in how the browser handles each one?"
A beta PHP7 version of @blackfireio should come soon. PHP7 is even not released yet !
Does anyone have a complete function for converting Exception::getTrace parts into a string without revealing variables? Or does anyone know what the 'type' entry is in the array that is returned by getTrace?
posted on October 08, 2015 by aliceljdc

/* by Nick Halden */

5 more weeks until PHP7.
16:13
I've seen way too many PHP/4.4.3 and the like in server signatures today.
@kelunik Find a RCE vulnerability and have them patch themselves.
@kelunik I know of at least one in the wild running 4.1.2...
(note, I am NOT actually suggesting that anyone actually use an RCE vulnerability. My last comment was meant purely as a joke on how insecure running old versions of end-of-life'd software is)
@Fabor As a friend said of it, it almost looks like art. Almost
user image
2
16:24
@Machavity Is that Windows 10's new BSOD? :P
I think the grammar is a fail there though
Your PC ran into a problem that it couldn't (ever) handle and now it needs to restart.
@Jimbo it's as real as the shrug operator
But the new BSOD is now Light Blue. Because
Here's a real one (yes it has a frowny face now)
@SaraMG @WesNetmo @SammyK @ircmaxell can someone reduce function to func?
if something ever gets abbreviated it should be 'fn' not 'func'.
The answer to this is probably 'reasons', but why doesn't call_user_func() put an entry for the file in the stacktrace when an exception bubbles up through it?
@ircmaxell Sending the PR now... Along with changing if to fi to be more bash-y.
16:34
@marcio call_user_fn_array()?
@SammyK please no
@Danack it doesn't?
@ircmaxell I'm going to say you fully endorsed it and everything. :)
@SammyK never cross an Italian from New Jersey
@ircmaxell Ha! You're a softy inside though. :)
that's what you think
16:35
I believe in you!
@Jimbo I don't think that's important enough. Function names in PHP are bad since ever.
@marcio Yeah, might as well start putting hyphens in the function calls - to keep the consistent inconsistency
nah, UTF8 gliphs
@Jimbo not sure what you are trying to argue here.
@marcio Not arguing, conversing...
16:38
@ircmaxell I can't reproduce on 3v4l - gist.github.com/Danack/7448636d13bd3468bb9f
@Jimbo what hyphens on identifiers has to do with the subject?
As CUF - the stack trace is printed as: #1 [internal function]: omg()
As a function: #1 /documents/projects/github/Blog/Blog/src/test.php(15): omg()
Oh, perhaps it was fixed for 7. 3v4l.org/HlQqB
@marcio We were discussing consistency, you mentioned function names in PHP are bad "since ever", I agreed... and said we might as well add hyphens to function names to keep the inconsistency (humour, perhaps you didn't get it because I'm English?)
dunno
@Machavity basically, it says that you saved the world because you stopped HAL 9000
also .. I can't letter
16:45
@Jimbo I do understand it was a joke, but I expected your humorous comment about consistency to carry a point of view about the original topic - 'fn' vs 'func' - nevermind :)
@marcio Oh nope, I have no pov on that
@JoeWatkins \o
@Jimbo I like English humor, tbh. It tends to be very obscure.
16:49
@marcio Lol, some people don't get it though. I submitted for a CfP in the US, specifically to a conf where I knew people, they declined - probably not because of the content (it was awesome) but because in the "why you should choose me" section I mentioned I like lots of beer - I don't particularly, just was a joke about PHPNW's free bar here in the UK. Meh
basically, it says that my current setup is barely "recommended"
@tereško and mine is below recommended :D
actually, mine is a bit below too (I have FX8370)
well at least since I don't have my second gtx 770 anymore
@tereško now the question is: awesome graphics or super bad programming?
@tereško I'm just on for recommended - GTX 780 :-/ specs drop so fast once you've bought the card
16:52
I am currently running an equivalent of standard R9 390 (well .. I actually have a 2nd generation PCB for a 8GB 290x)
@NikiC Working on disambiguating the TypeError docs per our chat in last PHP Roundtable.
Currently: > TypeError is thrown when strict typing is enabled and an invalid argument is given to a function.
Wanting to add: > TypeError can also be thrown when an invalid number of arguments are passed to a function.
Does that about cover it?
@Jimbo on the up-side: I am not worried about DX12 performance
@MarcelBurkhard really bad optimization. Blame consoles.
Hi! I have the loop that print related post, how to get the number of a related post?
@QueueOverflow Keep track of your iterations.
@Ghedipunk I have the counter, yeah. But it is not nice in my opinion.
17:02
Then write a nicer solution.
You're a programmer. To the software, you are a god. Take your godly powers and improve things.
@Ghedipunk Dammit :D I hasn't said that I use Wordpress, so I don't want to have own bicycles :D
Do what every good WordPress maintainer does: Hack core. (By the way, since sarcasm is not obvious in text, and is especially hard to express when there is a language barrier, this is bad advice. I'm making a joke on the general low quality of WordPress maintainers.)
@Ghedipunk I understood your sarcasm at once :) Anyway, thanks for answers!
You might get better advice on a WordPress specific site, such as wordpress.org/support
@Ghedipunk OK, thank you again ;)
@FlorianMargaine Thanks!
Abe
Abe
17:19
wordpress sucks so much that SE had to make a site specifically for it for not polluting stackoverflow
@Abe Wordpress has disadvantages, but can you to offer the better solution for standalone blogs?
Abe
Abe
when someone wants a random blog, i usually just suggest blogger
too bad PHP's docs aren't on github, otherwise I'd have an army of people contributing to the documentation effort for Hacktober
@Abe Really? Does Blogger not have the problems with its customization now?
@ircmaxell Not only for Hacktober.
17:33
well, true
@samayo Got it tentatively added to the list :)
user image
10
ruh-oh
Abe
Abe
@QueueOverflow it is pretty good now
lol
Abe
Abe
@SammyK \m/ can't wait for it
17:41
what's CST ?
Crazy Standard Time
is that in the middle of the night for us ?
@SammyK that's 2am for uk folk ...
midnight, sorry ...
pretty late, can it be done earlier than that ??
That's right at the start of my commute home.
wait a min.... is this an open chat. Retro nice! It was 90's night last night too.
@SammyK 2am, too early man :)
17:47
its either midnight or 1am @Jimbo, I think ...
@JoeWatkins Either way that's way past my bedtime :P
I've stayed up late to do podcasts before ... it didn't go well ...
@ircmaxell Getting late here mate, did you forget?
@SammyK can we move it backwards a couple of hours ?
@SammyK I think so
18:00
@JoeWatkins Yeah, I was thinking maybe 5PM CST. Would that be better? :)
@NikiC Sweet - thanks!
Who's responsible for the *.php.net servers again? ssllabs.com/ssltest/analyze.html?d=bugs.php.net
@SammyK that'd be better for us in the uk, ask around though ... earlier the better, I guess ...
might still be pretty late for niki and bob
@JoeWatkins @SammyK That would be midnight. Should be fine
@JoeWatkins I don't think Bob will have an issue with midnight. :-D
Hrm, been looking at this code with 4 gotos for a while, and can't figure out how to modify it correctly...
18:09
who thought it was a good idea to introduce gotos in php 5.3 anyway?
Anonymous
@SammyK Thanks. I can't wait :)
ZEND_HASH_IF_FULL_DO_RESIZE(ht); /* If the Hash table is full, resize it */
5
Typical php-src
@NikiC No it's not. It's got a comment.
If you manage to find a comment, it's bound to describe the obvious
W00t! :)
18:14
    if (0) {
convert_to_hash:
        zend_hash_packed_to_hash(ht);
        ZEND_HASH_IF_FULL_DO_RESIZE(ht);
add_to_hash:
        h = zend_hash_integer(num);
    }
Okay, I think I solved the goto problem
goto is awesome and solves all the things
user895378
@NikiC to be fair, this is the case in most codebases of any kind.
user895378
/**
 * Retrieve the widgets property
 *
 * @return string
 * @todo stop being such a docblock and/or comment wanker
 */
public function getWidets() {
    ...
}
I also like doctrine auto generated comments on entities
/**
  * Get title
  */
public function getTitle() {...
@rdlowrey Wait, you don't like docblocks on getters?
user895378
18:21
-__________-
/**
 * @return Thing
 */
public function getThing()
{
    return $this->thing;
}
Unless you're meaning specifically "returns Thing"
Verbosity FTW
public function getThing() : Thing
Yeah, looking forward :-)
Right, I'm off. Night
*cough-propertyaccessors-cough*
public $thing { get() => $this->thing }
18:27
I actually like AS3's approach (and surely other languages too)
public function get thing() { ... }
public function set thing($thing) { ... }
Or... wait There we go.
public $thing : ?Thing = null
@DanLugg so where's the underlying variable?
Normal property.
private $_thing;
public function get thing() { return $this->_thing; }
public function set thing($thing) { $this->_thing = $thing; }
I still don't see a need for getters…
Only for setters.
18:38
give me typed properties, and 97% of the need for getters/setters disappears
Um, immutability? Without wonky readonly rules?
@bwoebi compute on fetch, lazy computation
@ircmaxell True.
Calculated properties.
@ircmaxell if you need that, you don't want a property, but a method.
You want methods for derived values, no properties…
@bwoebi sometimes yes, sometimes no
but in general, I'd avoid getters/setters all together if you gave me typed properties
user895378
18:41
@Jimbo later
@ircmaxell But wouldn't getters/setters give you the same control (albeit, a bit more verbosely) and more?
@Jimbo sorry man, didn't really have time today either. We can do a call tomorrow as I drive, if that works...?
@DanLugg a bit more verbosely? public $thing: Thing; vs that three line blob?
@ircmaxell I honestly fail to see where computed properties would be better than actual methods for that
user895378
@Fabor wait, is this legit?
@ircmaxell Yea, but IDEs today do method generation as it is.
NetBeans > generate getters/setters > select desired properties > boom.
18:42
And hey @rdlowrey :-)
+ code-folding, they'd be fairly unobtrusive.
@DanLugg I don't give two shits about how long it takes to write. I care about the cognitive overhead of reading, of comprehension (looking at a list of 30 methods on a class to determine that only 4 of them do anything
and code folding is a band-aid on poor design
you should feel the pain of your bad design, not just hide it away
Agreed, but reducing visual noise when focusing on methods X and Y is helpful.
I get your point (I think) in that there shouldn't be any (or minimal) visual noise when inspecting a class.
well, getters/setters are pure noise
user895378
@bwoebi o/
18:45
I'd like typed properties in lieu of accessor/mutators, if we got a readonly modifier too.
Because you're certainly right, 97% of the use cases are just that.
public readonly $thing : Thing;
How about reusing final there?
^^ Doesn't Java do that?
public final $thing: Thing;
not bad
I like.
though final in Java means something different IIRC
18:47
Oh, okay.
Nope, for properties it's exactly that. Has to be set and can't be changed (at least not after construction).
well, it has meaning in terms of inheritnace as well
So, final as a readonly modifier; locks the property from being written after __construct or __clone returns: would that be acceptable behavior?
@rdlowrey \o
@DanLugg and unserialize/wakeup
18:48
^^
though, how do you do that reasonably?
newInstanceWithoutConstructor would be so horrendous. (not that it isn't already)
@ircmaxell Flag in the property table?
@ircmaxell Oh, you're right. Well actually, I don't think there's a special meaning, because nothing like overriding properties.
@DanLugg ok, but there's more to it than that
Understandably; what're you referring to?
18:51
@SammyK december 4 is SymfonyCon btw <_<
@kelunik well, I know that there was some restriction in inner classes that required imported variables to be final in the parent... Not sure why
How about public final Thing $thing; instead of return type syntax?
@ircmaxell Might have been due to threading protections.
@kelunik While I find that syntax preferable, we're already down the rabbit hole.
Consistency > all the things IMO.
It's consistent with argument type declarations.
Yea, but the semantics of property access/mutation are more akin to functions... again, IMO.
Meh, I'm too jaded by get/set.
18:53
@DanLugg well, there are a ton of places in the engine you need to change to check that flag. It'd really need to be on the ZVal itself, due to the expression syntax in parsers (there are cases where you don't know if it's a read or write until after the fetch)
@ircmaxell I recall a weird case of __get magic by reference... is that the sort of thing you're talking about?
@kelunik I could see arguments for either. Actually, that may make more sense given default assignment public int $foo = 1; looks better than public $foo : int = 1
@DanLugg yeah, among others, but yeah
Okay, so a non-trivial feature to implement.
Well, it'd be the same level of effort as normal read-only variables
const $var = 123;
so if you can implement that, then awesome!
const $var = [1, 2, 3];
Default assignments are a good argument, yes.
18:57
hm, nope
well, we don't "need" const variables, but it could be a good backend
function foo(const int $abc = 1) {
    $abc = 2; // fatal error
}
could be interesting
Again final there?
why final? why not const?
Morning people
it's not final
it's constant (can't change)
19:00
if it can't change, it's final ^^
Constant makes more sense to me than final... I'm not from a Java background, so don't attach any value to that word, so const is what my PHP-addled brain would think of first.
I have no idea why Java calls const final
Makes no sense
Because OO.
Only causes confusion with final in the sense of not overridable
My ideal of accessors would be, no getters and setters a function you're passed in the old and the value to be set… you return the value to set… or throw an exception.
19:02
Final, to me, has the semantic baggage of being the last in a list of something. If it's the first and can't be changed, then it's the constant something, not the final something.
They're just ashamed of not having everything be a class.
@NikiC Confusion? It's "can't change" for methods, properties and parameters for me, so seems consistent.
@ircmaxell a constant value in the param list???
@kelunik "Can't override in child class" and "Can't modify value" are not at all the same
@bwoebi I know some people marking every parameter as final in Java.
19:05
Oh, we're talking about immutable variables after first setting
const makes sense for properties and variables then, ok.
function foo(const int $bar = 2) {
    // $bar++; // Shouldn't work.
    echo $bar;
}
foo(4); // Prints 4.
foo(); // Prints 2.
hello! i need some help with regex for extracting html img tag. the problem is that i don't know how to correctly stop function to read only each tag start and end with content, without other content which could be between more tags. here's what i have so far: regex101.com/r/sQ5iI9/1 <-- each img (<img ...></img>)tag should be matched as one, so the text between those two tags (in example) shouldn't be matched. thanks for help in advance!
TBH, variables which aren't references should be constant by default in param list…
Also, I absolutely hate the fact that func_get_args() etc. don't mirror the original passed values…
19:08
@bwoebi Unfortunately, too much BC break.
I wasn't talking about implementing it… just talking about my ideal world.
@PaulCrovella: thanks for this, but i would like to use this regex with preg_replace, because i need to comment out those images...
@user1257255 You want * and + greedy: (<img.*?src=["']cid:.+?@[^"']+[^>]*(?|>|<\/img>)*).
4427
A: RegEx match open tags except XHTML self-contained tags

bobinceYou can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool th...

@kelunik I certianly hope just were struck by the easter egg for that
@user1257255 Before anyone here will help you use regex to parse HTML, please type out the following phrase: "I, [my name here], do fully understand that by using regex with HTML, that I am creating a permanent portal in my bedroom to the underworld, and am explicitly inviting Cthulhu into my life for all eternity."
user895378
19:10
the <center> cannot hold.
@user1257255 still no reason to insist on a regex, php.net/manual/en/domdocument.createcomment.php
@PeeHaa Sure. :-)
:)
@user1257255 J͖͕̞͊ͪ͌ͦ̿͢u̘̻͎̮͛͜͜s̮͇̈̌̎̆̾ͥ͝t̶͔͔̮͙̆̓ ̶͍̞̜̱̆ͮ̽͊ͣ͂͘d̛͇̲̟̭͎͑̿͗̕̕ȯ̵̞͈̻͙͗͋ͣ͑n̻̮̭͊̄̐ͪ̇͌̀'̢̹̜̟̼̼͛͂͘ẗ̮̙͕̙̣̼̯́̿̕
Parsing HTML with regular expressions all the time at work. :-D :-(
<__<
19:15
Only Chuck Norris can parse HTML with regex, and that's only because he roundhouse kicked a tentacle off of Cthulhu.
chuck norris doesn't need a regex, he tells html to parse itself
7
Not true. Jon Skeet can parse HTML with regex. Sadly, nobody else can replicate his method without going insane
@Ocramius Maybe we can have some late-night SymfonyCon people join. :)
@bwoebi sure, why not?
@kelunik thanks for solution... in my case regex is the best solution, because i unfortunately don't work with valid html and there is a lot of other elements along, so i just need to somehow comment/delete those img tags out ;)
19:19
@kelunik precisely
@PaulCrovella Apparently Chuck Norris is valid HTML
@PaulCrovella you forgot the punchline: and it does!
@user1257255 invalid html is more of a reason to use the dom extension instead of a regex, not less of one
@user1257255 White-list. Don't black-list.
user895378
so I've answered like 5 questions in the last ~2.5 years and I'm finally approaching 20k trusted user status from my weak ~25/day passive rep.
19:22
:-)
I've only answered like 30 in that timespan
and average like 30-100 rep/day passive
also, visited 1974 days, 1971 consecutive
user895378
show off ;p
comparing guns never seemed so nice :p
I've answered 80 Imagick questions in that time frame, for like <400 rep total
I've got 56 more answers unitl I get a gold in
19:25
I answer questions on the regular and just get thanked in the comments.
user895378
@PaulCrovella is in the StackOverflow friend zone lol.
user895378
You gotta go full rep-whore if you don't wanna get friend-zoned, man.
not sure if I admire or take into pity drawing chicks with ascii art
slightly NSFW^^
@FélixGagnon-Grenier I thought it looked pretty cool
19:38
@ircmaxell Yeah, I misunderstood constant at first… I thought "you can't pass in any other value there except the default one"
@bwoebi :P
yeah, that's for the admiring part @PeeHaa :)
@tereško well, this settles the last nail in the coffin of my frenchy-coding days
huh?
comic strip about the french coding guy. nvm
19 hours ago, by tereško
@FélixGagnon-Grenier http://www.commitstrip.com/en/2015/08/21/the-story-of-a-coder-who-doesnt-speak-e‌​nglish/
19:52
youtube.com/watch?v=IaUhR-tRkHY (about cults and/or religions ... with shitty graphics but good content)
Hai, boring quick question - I need to redirect/disable access to a bunch of pdf files somehow if a column in db is a past date. How should I handle this if it's somewhat possible?
@Ekin Yep. You're right, it's boring
@Ekin store files outside document root, use a php script to serve those files with a specialized script
room11 cultification ftw.
makes sense, alright thanks
19:59
watch the video, @FélixGagnon-Grenier :P
it will be worth your time .. and after watching it you will agree ... and you will have this nagging feeling that you yourself were an experiment subject just now
20:11
@Ekin if you're dealing with large files use 'mod_xsendfile' (google search will bring the best results)
that's for apache I guess, but I get what you mean thanks
Anonymous
@tereško next time i'll flag it
@SammyK depends. What's your TZ? I remember round table being at horrid times in the night
@samayo why?
Anonymous
Because it's condescending.
20:20
actually it's anything but condescending
@samayo @tereško you shouldn't go down that road again, just leave that topic be
:D
Anonymous
I won't. I off to sleep now.
Anonymous
new potential room-mate comes tomorrow at 10am for a visit.
@Ekin this tells exactly what you could do ~> codeutopia.net/blog/2009/03/06/…
server is nginx but I guess rest applies
20:25
there are alternatives for nginx too, but I don't remember the module name.
@marcio I thought it was the same name
X-Accel-Redirect it is
Yeah
@PeeHaa IIRR the header is different.
ah that's it :)
hmmm....
good job @tereško. now I can't tell anything from anything else :p
20:33
13 mins ago, by samayo
Because it's condescending.
@tereško [x] watched
not really condescending. Have I been manipulated in thinking that?
@FélixGagnon-Grenier that was the answer for why he threatened to flag the video
the video is manipulative too? :p
36 mins ago, by tereško
it will be worth your time .. and after watching it you will agree ... and you will have this nagging feeling that you yourself were an experiment subject just now
20:36
@tereško s/condescending/mad, evil and weak/
well yeah. I'm tempted in using some of the terms used in it to describe the thoughts I have right now
I guess I'll have another Moralité
21:08
Damn php has an array function for every thing php.net/manual/en/function.array-diff-key.php
@PeeHaa and cool tricks hidden within them 3v4l.org/uq4PG
@PeeHaa except for that operation you need.
@marcio Neh most of the times I have already written it myself only to think: PHP doesn't also do that rite? -> check docs -> omfg php..
In totally unrelated news. I just wrote a queue using postgres and I feel bad
Why would that make you feel bad? (And no, I'm not playing the Eliza therapist script.)
@Ghedipunk Because I picked the worst tool for the job, but I am too lazy to setup a proper environment :P
21:22
Is it the queue that's the wrong tool, or Postgres?
postgres
setting up a proper queue is easier than doing it wrong
But... but... That's my favorite RDBMS!!! It can't be the wrong tool for anything! ;-)
@Ghedipunk :P
@PaulCrovella Yeah, but it involves doing research
You could always go no-SQL... >;-)
21:25
It would make it instantly webscale
@PeeHaa You didn't pick MySQL.
@kelunik True mysql and flatfile would have been worse
For an extra challenge, you could utilize steganography... Embed the queue data in the least significant bits of images...
/me looks at his code. I already utilize steganography... :P
After following PatrickLouys's no framework tutorial, I find myself with a public index.php containing mainly a require for vendor's autoload and an include of a bootstrap file. Did I just get it wrong? What should go in the index then? The logic itself seems to be hidden further down in the classes, and routing as well as auryn settings take place in the bootstrap.
21:40
@FélixGagnon-Grenier You have too much in your index ;)
My index.php:
<?php

require_once __DIR__ . '/../bootstrap.php';
nice
alright, thx :)
The actual requiring of the vendor stuff happens in the bootstrap file
yeah, you just made me realize I don't need it in the index
well, I guess that's for the best then
:-)
@FélixGagnon-Grenier he has been doing that ever since he accidentally ended up showing us his framework, where missing / caused raw code of index.php to be sent to the browser
21:45
sounds bad. I hope crucial informations weren't hardcoded right there...!
nope
Neh. It was mostly educational for people who put stuff in there ;)
but everyone in room 11 laughed at him
I think I even have a bookmark of that
21:46
@PeeHaa your preference for '/../bootstrap.php' over '/../src/bootstrap.php' clutters my bikeshed's project directory

Don't put logic in your webroot yo!

Dec 16 '13 at 22:05, 2 minutes total – 16 messages, 5 users, 0 stars

Bookmarked Dec 16 '13 at 22:12 by PeeHaa

@PaulCrovella deal with it gif :P
well, I have:
<?php
    require __DIR__ . '/../applications/bootstrap.php';
    require __DIR__ . '/../applications/website/launcher.php';
    require __DIR__ . '/../applications/website/presenter.php';
but there were "reasons"
related to the website vs mobile api you mentioned the other day when discussing file structures @tereško ?
21:53
being confronted to massively simpler cases, I think I'll stick to the simple bootstrap include :)

« first day (1818 days earlier)      last day (3356 days later) »