« first day (1557 days earlier)      last day (3394 days later) » 

9:00 PM
@ircmaxell 12 MB of pure code, nearly no comments, about one tenth of the chars are mysql queries. Good luck fixing it.
 
@bwoebi it's trivial to fix. Go to the queries, where variables are concatonated into it, escape them.
 
function print_view($templateName, array $params = array()) {
    $path = $_SERVER['DOCUMENT_ROOT'] . '/views/' . $templateName;
    if(file_exists($path)) {
        if(!empty($params)) {
            extract($params);
        }
        include_once $path;
    }
}
 
it may take you a day to do
 
looks good to me :)
 
@ircmaxell it's trivial to fix, it's just so much of work
 
9:01 PM
@bwoebi a day, maybe
 
@ircmaxell one day? you really think it will only take one day?
 
@salathe good :-D
 
@salathe I wonder why the empty check is there?
 
@bwoebi it's not going to take you nearly as long as you think.
 
9:03 PM
@ircmaxell also, there are tons of str_replace, addslashes and stripslashes in code… a lot of things relying on the fact that single quotes are escaped to be able to inject them into javascript quotes etc.
 
@ircmaxell The hard part is that you generally have to port the WHOLE codebase at once.
Hard to migrate pieces.
 
that too
 
@LeviMorrison which is why you sit down and bloody do it, not pretend that it's something that's too hard and let it sit
@bwoebi then fix that too
hell, you could sit down with 2 devs, hand one javascript, another SQL, and be done with it
make a party out of it
 
@ircmaxell If I wouldn't fear to introduce new vulnerabilities.
 
buy pizza and beer
@bwoebi so you won't fix existing vulnerabilities because of fear of adding new ones?
addslashes/magic_quotes does not work for javascript
 
9:06 PM
@LeviMorrison I don't know... let's see who touched that code last...
user image
2
 
@salathe ^^ but did I change the empty check?
 
the empty() was for the foreach that you swapped out with extract() :)
 
@ircmaxell also, if I fix it, I'd change everything to prepared queries too...
It's not just escape them
 
@bwoebi that's potentially a lot harder, especially with dynamically constructed queries
 
but you really easily oversee a single query and there's an attack vector again
 
9:08 PM
 
@salathe Ah, I see. The foreach was just a silly version of extract.
I just didn't catch the needless empty check.
 
extract is a silly version of extract
 
wrong window…
 
I would rather use extract than write a foreach with variable-variables.
 
Yeah, let's kill variable variables while we're at it…
 
9:10 PM
why? they're variable.
 
(for @ircmaxell's benefit: kidding)
 
@LeviMorrison @salathe github.com/php/web-php/pull/58
@salathe +100
 
@ircmaxell you PR'd on your own repo
 
I actually don't have the necessary karma (or maybe I do now and just don't know it) for PRs.
 
just saying... already happened by accident to me.
 
9:12 PM
@LeviMorrison If you have commit karma, you can merge PRs too... qa.php.net/pulls
 
@FlorianMargaine DAMMIT
fixed
 
yeah. Happened to me. It's ugly.
 
GitHub will close the PR when you merge in the relevant commit(s).
 
@salathe Do you have a working php.net env locally at the moment?
 
@LeviMorrison I never leave home without one.
 
9:14 PM
I don't since at some point we (or maybe an updated behavior of a utility we use) started deleting things from .git/ when I run rsync.
This makes it stupid hard to have a working env that is also git managed.
@salathe Could you test the PR and then merge it then?
Mine is woefully out of date.
It looks correct and harmless, but better to check ^^
 
Yep, sure I'll "test" it then merge.
 
Righteo ^^
 
@LeviMorrison yup, I've only proven it correct, I have not actually tested it :-P
 
that function isn't even called, at least in the web-php.git source...
 
lol
 
9:17 PM
Aha! @ircmaxell Remember when I said not everything that is is_callable()//true could be called properly? There was a bug fixed in 5.4 yes, but I think I was remembering this behavior: 3v4l.org/1oSO3
A::hiStatic <- won't work.
 
IMHO that should not be valid callback syntax
but fair
also:
 
user895378
@LeviMorrison I've run into this problem before.
 
@ircmaxell You mean ${"A::hiStatic"}() shouldn't work?
 
@LeviMorrison IMHO yes
 
Hmm… why is that?
 
9:24 PM
because how many varieties of the same thing to do we need?
and this requires string parsing
either ["A", "hiStatic"] or "A::hiStatic", but not both, and considering the first is -reused with instances, that
 
9:36 PM
@Patrick hmm ... well, they are offering a bit more money then my current job and the company seems to be moving from codeigniter written legacy code the custom-written projects and looks like the primary focus would be on an in-house project. But ... the locale is worse and by extension - the nearby eating options. Not sure about the commute.
I think I will be visiting them this week, then I will decide what to do
 
@ircmaxell I agree
 
@ircmaxell FTR, thinking it through some more I'm definitely voting no, for two reasons: 1) what are you passing through as arguments if it doesn't exist yet? How do you know if it can be called that way if it is added in future? and 2) the obvious issue of side-effects.
 
I think we should deprecate the "A::foo" syntax, instead of adding more support for it
 
while at it, deprecate statics altogether ;)
 
@Patrick main issue is that I actually wanted few month off, because I have not had any vacation and have been on the edge of burn-out for past 3 months
 
9:38 PM
@tereško the eating options at my workplace are horrible (very expensive and not really good), so I resorted to just bringing my own meals (precooked or salads). Inconvenience made me eat healthier in the end... :)
@tereško can you get that at the new one?
 
@Patrick by law you have to work for 6 months before you can get a paid vacation
 
@salathe ^^ glad to hear we aren't using print_view anywhere atm.
@NikiC It's actually useful if you make config files that have a notion of "use this function to handle this case", though.
 
@tereško that sucks... unpaid is not an option then? If you haven't had any yet I'm sure they have to pay out the hours?
 
To be honest, we should deprecate [$context, $method].
It's definitely not intuitive and has some foobar stuff like ['parent', 'static::method']
 
user895378
@LeviMorrison How else can we specify "this method on this instance"
 
user895378
9:41 PM
?
 
@Patrick yes, but the point is that I dont want 4 weeks off .. more like 10
 
@LeviMorrison In favor of proper language support, yes.
But in favor of "A::foo" syntax, that's inconsistent with instance callbacks and badly supported, no
 
@rdlowrey Maybe callable($a, 'foo) ^^ Maybe
But yes, there is nothing currently.
I really think we should work to an eventual better solution here, though.
The array tuple is nasty.
 
user895378
@LeviMorrison the relative static callables do make me crazy.
 
4 weeks of binge-gaming and listening to non-stop audiobooks and then 6 month of learning new stuff, @Patrick
 
9:42 PM
I would not feel bad if a Senior PHP dev did not know that this was a callable: ['parent', 'static::method']
 
@tereško And they can't put something like that in the contract? Like start late + a signup bonus or something like that.
 
@DaveyShafik well, it also gives people the false notion that it's OK to blindly call methods without knowing what's on the other side
 
@NikiC Any specific ideas we could work towards for PHP 7?
 
@LeviMorrison no
 
@Patrick doubt that
 
9:43 PM
@tereško meh... party in a beach paradise > gaming :D
 
it's january
 
I know, it sucks :(
 
@NikiC callable(A::foo) is doable with altered parsing rules to check methods instead of properties/constants when doing A::foo.
 
there is no "beach party" in latvia till may ... unless you can grow fur on your balls, i'm not a fucking moose
 
But… don't like altered parsing rules.
 
9:46 PM
callable(A::foo(λ)), so whenever you pass the magic lambda constant to a function or method it will automatically return a closure for that. because magic is awesome :)
 
Maybe callable(A, foo) or something.
I don't know.
The best solution in my eyes requires unified property/constant/method bucket (or at least not allowing conflicting names across them).
Then A::foo is a callable simply by being referenced ^^
There's still the matter of how to call it with a context though.
 
@tereško oh and about the burnout stuff, ever thought about switching to 80%? (if you can afford it). I usually use the additional day to learn new stuff/work on some projects or just relax if I feel like it. A very big quality of life improvement...
 
@NikiC If you think of something actionable for PHP 7 and callables from methods + contexts let me know. It's one of the highest priority items on my list, I just don't know what to do about it so I don't have a proposal.
 
@Patrick I doubt that it would be an option either
 
Happily will drop nullables and even PHP 4 constructor stuff for it.
 
9:50 PM
@LeviMorrison I don't know anything that's "quite right" either. I didn't like the notation from Andrea's original proposal much
 
I don't even remember @Andrea's original proposal.
Anyone remember the URL for it?
 
It's the one using &
and coverting only some cases. And being unbound iirc
 
I'm okay with unbound closures because I actually have a use-case for that.
But & won't work because of references.
 
aw gawd
that "Librarians" series is fucking nightmare
I want my 10 minutes of life back
 
@DaveRandom Status of [...$in] support?
 
9:56 PM
np.reddit.com/r/PHP/comments/2rl9cn/… <-- ahh, the quality of reddit
 
vim: the editor you need to know how to use, because when you are in the middle of nowhere and having to fix a crashed site of your fucking phone , vim will be all what you got
 
@ircmaxell archaic tool like sublime slowly backs out of the thread
 
yup
 
> We've already moved to plain Linux environment using git as our only CVS.
 
he meant VCS... come on
 
10:00 PM
no
looks at the whole post
 
read the comments, they are awesome
 
it has been written by a 14 year old, who's pretending to be a developer
 
who somehow has developers reporting to him
 
in his imagination only
 
quality? reddit? in one sentence? E_FATAL
5
 
10:02 PM
@tereško no, I've seen managers like this
 
maybe I have led a sheltered life
 
I can not down-vote that post fast enough or far enough.
 
@SaraGolemon I'm just happy the commenters realize the horror
sometimes on reddit, you get a horrible first post, followed by tons of people supporting it in the comments
 
10:08 PM
This was my favorite comment:
> God himself could make an IDE, and you'd still have no business dictating what I use.
 
@ircmaxell That's ... actually quite a reasonable thread, right?
Well, apart from the OP I mean
 
Honestly, I'm okay with dictating IDE's if that's just what you've done from the very start. There is a certain level of productivity of everyone using the same tool. I've experienced this in a class I have taken at a university. In our case we agreed to it, though; it wasn't demanded by the course instructor.
 
@NikiC apart from the OP
 
But to take an existing team, possibly coding for years on this product, and to force an IDE of any kind? That's painful…
 
@LeviMorrison whole heartedly disagree there...
use what you're good at
 
10:11 PM
@LeviMorrison Unless you're programming in Java, probably not
 
Well, we are programming in Java.
^^
 
okay then ^^
 
In case anyone is wondering, we chose to all use IntelliJ IDEA.
 
that's the most reasonable of them
 
@LeviMorrison yeah ... here we chose Eclipse. And still suffering from that.
 
10:13 PM
@NikiC IntelliJ gives free 1yr license if you have a .edu address, in case you guys don't know.
 
I used to have an .edu address, a .gov address too. Now I'm a .com weenie
 
But there are a few key points: we agreed to use the same tool. It's easier to help each other when you are using the same environment.
It wasn't forced on us.
 
I dont care what editors they use, as long as they use NIX newlines and spaces
 
NIX spaces? there are other spaces?
 
We also aren't working on an existing code base or with developers who worked on the project for a long time.
Totally disrupting someone's long-standing, productive work flow to mandate an IDE? Yeah, I would quit that job unless I needed it badly for some reason.
I really just wanted to chime in and say it's easier to help each other when you are all reaching for the same tools.
 
10:15 PM
@FlorianMargaine the "and" was to separate "nix newlines" and "spaces"
 
@FlorianMargaine Wait, you didn't know? Everybody indents their code using U+205F Middle Mathematical Space nowadays.
 
tbh I already worked as a consultant, and the manager wanted to mandate an IDE for all their devs, I supported him. The devs all used notepad++ and didn't know how to use a debugger or didn't know what that was. And their "best" dev used said-IDE.
 
we currently have one guy who uses notepad++
he used to leave a trail of index.php~ files in his wake
 
does he suck?
 
You can mandate people needing to be able to debug stuff....but mandating an IDE would probably violate several laws in the UK/US if you didn't allow people who suffer from RSI to use vim.
 
10:21 PM
@FlorianMargaine yeah, kinda. It's somewhat related to him being in the same company for 5 years and noone ever pushing him to learn new stuff
 
I dont care what IDE or OS I use.
I mean, I have my preferences and would prefer an environment where I can pick, but it's nothing that would make me quit
 
I have strong opinions about pre-XP, Linspire and Ubuntu
 
eclipse might get me to quit
 
would someone be willing to look at a discussion in comments of an answer to my question and tell me if i'm off base with my understanding of polymorphism?
 
@SteveBuzonas go ahead and post a link, if someone is interested they'll take a look
 
@LeviMorrison It works fine on a technical level, perhaps not from a readability/user confusion standpoint
 
function conjoin($in, ...$values) : \Traversable {
    foreach ($in as $value) {
        yield $value;
    }
    foreach ($values as $value) {
        yield $value;
    }
}


function array_conjoin(array $in, ...$values) : array {
    return iterator_to_array(conjoin($in, ...$values));
}
<3 PHP 7
 
Hey
Something outside the scope of PHP, has someone information in how you can grow as as web project manager? There is no study like 'webproject manager' :D internetarchitects.be/jobs/online-project-manager
 
10:44 PM
 
Also, \o/ for $f()() in PHP 7
Nikita's RFC's are the best RFC's.
 
11:03 PM
> Having to go back to using a mouse would slow me down a ton. Lots of people underestimate the amount of time and how many motions are wasted going back and forth between the mouse and keyboard.
I always fail to understand this argument
 
@LeviMorrison Apart from the named parameters one, which sounds horrible to me.
 
Me too ^^
 
Can you see any problem with the 'default' placeholder one that Stas is championing?
 
Isn't that even worse than the named params one? It subsidizes bad APIs without any of the readability improvements of named params
 
@NikiC I like the explicitness i.e. that you're documenting in code that you explicitly don't care about a param, and the fact that it will produce errors if a function being called has a change in the number of parameters.
So it's less worse.
 
11:11 PM
@Danack somebody pointed out that, for consistency, ones should be able to use the same blank identifier allowed in list: list($a, , $b) = ['good', 'trash', 'good']
 
consistency, ma-schmistency.
 
I don't buy the consistency thing, but it would prevent lang syntax from growing just to have param skipping
last time I read the thread stas was trying to find a word that could be used in both contexts, like "skip":
 
People have said already, but that has a great potential for 1 character errors.
'whatevs'
 
list($a, skip, $b) = ['good', 'trash', 'good']
functionCall($a, skip, $b)
 
I'm gonna go to bed early, I'm tired... goodnight all
 
11:15 PM
@SteveBuzonas You're fine, I think the confusion in the discussion comes in part because the original question is sorta poorly put together. Your Vehicle example isn't great, and one of the more important things about Traversable isn't just that you have to implement it by way of implementing an interface that extends it, it's that you have to implement an interface from a particular set of options that extend it
 
You know how we have ::class to get the fully namespaced string for a class?
I didn't like the proposal but it's useful.
I think I figured out why I didn't like it:
 
@marcio or allow null to be assigned and act like /dev/null
 
compose::function <- give me the fully-namespaced string for that function.
This just doesn't scale to other features well.
For instance:
 
@SteveBuzonas how?
 
$a = reduce($f('PHP\Algorithm\array_conjoin'), [1, 2, 3], []);
Would be nicer if I could do something like:
$a = reduce($f(fqn(array_conjoin)), [1, 2, 3], []);
 
11:20 PM
@NikiC Do we know what caused news.php.net/php.internals/80910 ? I had a similar issue when porting php-uv a few days ago, only issues without compiler optimizations… and started working when I substituted everything by zend_string*
 
@marcio just a theoretical, i suppose it would be ambiguous for function calls and other constructs
 
> Both Nikic and Michael suggested it probably had to to with int instead of size_t for the arg lengths
 
oh makes sense…
because va_arg size? … well, thanks
 
@PaulCrovella thanks for taking a look, I couldn't think of another example like Traversable. I had one when I initially had the question, but I was just loosely throwing around ideas in a brainstorm.
 
@bwoebi yes
it makes a difference whether size is 4 and 8. And due to the way varargs passing works the result is not always obvious
 
11:24 PM
does it in -O3 directly use bare registers w/o mem fetch so that it doesn't fail there?
 
use function \PHP\Algorithm\compose;
use function \PHP\Algorithm\filter;
use function \PHP\Algorithm\map;
use function \PHP\Algorithm\reduce;

$odd = function($value) {
    return $value % 2;
};

$sqr = function($value) {
    return $value * $value;
};

$f = compose(
    filter($odd),
    map($sqr)
);
$a = reduce($f('PHP\Algorithm\array_conjoin'), [1, 2, 3], []); // [1, 9]
 
oh, yeah, null would works for list() but not for function calls.

Frankly I wouldn't pick a word for that, a very generic and less semantic single char token would be better. I'd just pick a char, call it "blackhole assignment" and move on:) In golang, they use a "_" as blank identifier and it just works (we can't use _ for PHP, just an example)
 
@SteveBuzonas No problem. To run with the example anyway, really you just want to typehint not that you can take a Vehicle (since my Train would screw the pooch) but that you can take either a Car or a Boat - since you can't do this just kill the hint and check the parameter within the method.
 
@LeviMorrison This is where @marcio's suggestion would be quite nice ... use function PHP\Algorithm { composer, filter, map, reduce };
Also, drop those \ at the start of the uses pls
 
I don't actually use them ^^
It's just there to show where they came from.
Code sample is actually in same namespace.
Theoretically in PHP7 it could look like this:
use function PHP\Algorithm {
    compose,
    filter,
    map,
    reduce
};

$f = compose(
    filter($v ~> $v % 2),
    map($v ~> $v * $v)
);
$a = reduce($f('PHP\Algorithm\array_conjoin'), [1, 2, 3], []); // [1, 9]
 
11:30 PM
probably even $v ~> $v * $v
 
will it be ($v) ~> $v * $v or $v ~> $v * $v ?
 
one-tuples usually elide the parens
 
I would guess () to be necessary for multiple parameters?
 
@LeviMorrison yes
 
But yeah, for single-param maybe it could be omitted.
 
11:32 PM
@NikiC that'd be a bit inconsistent with the rest of the codebase…
 
@LeviMorrison hm, probably best not to do it
after all we also want to support more than just the param name, right?
 
hm?
 
or maybe we actually don't want
 
$f = compose(
    filter(($v) ~> $v % 2),
    map(($v) ~> $v * $v)
);
$a = reduce($f('PHP\Algorithm\array_conjoin'), [1, 2, 3], []); // [1, 9]
 
i.e. does (array $a) ~> $a make sense?
 
11:33 PM
no.
 
or do we stick with only simple params?
 
that looks like a weird cast
 
if we stick with simple ones, then we should elide parens if possible
 
@NikiC I want so bad to draft this RFC ^^ github.com/php/php-src/pull/1005 but still haven't got RFC karma on my wiki account :s
 
@NikiC which will make problems if we ever choose to require parens
 
11:34 PM
can't help you there, I don't think I have the necessary perms for the wiki
@bwoebi ... obviously?
 
@NikiC not sure, but we nowhere elide parens.
 
@NikiC Required for 0-arg, not for 1-arg, required for n>1-arg.
Would be a bit strange.
 
@LeviMorrison yep, that's how it's usually done
 
@NikiC not sure, but won't that make issues with default values?
 
@bwoebi Which is why I was asking whether we want to allow complex parameter lists
 
11:38 PM
@NikiC not liking typehints there, but maybe default vals (personally)
 
Even if we don't have any short-lambda, this is still nice:
function conjoin($in = [], ...$values) : \Iterator {
    foreach ($in as $value) {
        yield $value;
    }
    foreach ($values as $value) {
        yield $value;
    }
}

function array_conjoin(array $in = [], ...$values) : array {
    return iterator_to_array(conjoin($in, ...$values));
}
 
so, I think well, we should allow complex parameter lists
 
Hooray for generators, ... and return types!
 
@LeviMorrison still missing a yield-from operator ^^
 
yield-from operator?
what should it do?
 
11:40 PM
@LeviMorrison the "~>" T_SPERMATOZOON looks really good on short lambdas :)
 
function conjoin($in = [], ...$values) : \Iterator {
    yield* $in;
    yield* $values;
}
using JS notation
 
Ah, so basically "yield all the values from this iterable thing"
 
though the real purpose is delegating control to sub-coroutines
essentially its language support for the stacked coroutines hack
In Python the syntax is yield from
 
@NikiC wasn't that one of the things which cost a lot of perf in amp Generator resolving? \cc @rdlowrey
 
user895378
@bwoebi Yeah, a yield from equivalent would significantly speedup the co-routine things we do.
 
11:58 PM
I'll have to try implementing that sometime...
I wonder if this feature isn't too specific to include
on the other hand it's really just a "function call" for coroutines ^^
 

« first day (1557 days earlier)      last day (3394 days later) »