« first day (1473 days earlier)      last day (3491 days later) » 

3:00 PM
@Danack please just read this :

public function query($query){
$this->stmt = $this->dbh->prepare($query);
}
public function execute(){
return $this->stmt->execute();
}
$this->Query_ID = $this->execute();

echo "<pre>";
print_r($this->Query_ID->fetch(PDO::FETCH_BOTH));// this bit is giving this error :Fatal error: Call to a member function fetch()
echo "</pre>";
 
3 mins ago, by Danack
What do you think the value of $this->Query_ID is given that "PDOStatement::execute - Returns TRUE on success or FALSE on failure."
 
posted on October 28, 2014 by kbironneau

/* by GeekyEggo */

 
<?php
 
@ircmaxell I'm glad everyone can agree what is best for code that hardly anyone will have read, very few people will have run ... real glad ...
 
...
 
3:05 PM
@JoeWatkins consider the compromise
 
@JoeWatkins I think people are sticking their noses in at least in part because they're getting interested in it and can see how useful it would be. And that's almost certainly the cause of Derick acting like a bell-end. He can see that xdebug would be completely replaced.
For people who invest a lot of pride in how many people use their projects (and see their name every time it's run) that's got to hurt.
 
no, can't happen ... on purpose it cannot happen, why would we set out to replace xdebug, that's not even a sensible thing to do ...
 
user895378
/me still believes phpdbg should be separate from PHP until it's more mature.
 
user895378
@Danack pushed those changes, tagged rc5
 
@Danack I don't think it will be replaced until there is out-of-the box support for debugging web requests
 
3:12 PM
@rdlowrey thanks.
 
@Tyrael and I don't think that's ever, considering the different approach (unless it stops just being a SAPI)
 
yeah, they aren't really interchangeable
 
user895378
@JoeWatkins FWIW, my websocket thing could also debug web requests as it has a full-blown webserver built in.
 
The only thing you wouldn't be able to debug through phpdpg were issues with php-fpm...everything else could be done through the phpdbg sapi right?
 
so I don't think xdebug will go out of business or anything
 
3:13 PM
bob has done a tiny tiny amount of work in this area, trying to think up ways to make it work, but it will never be a robust debugger for web requests .... that's not a problem we were trying to solve ...
 
I think they can work together.
 
@JoeWatkins honestly, if the autoloading of ini configs is done, I don't see why it can't robustly debug web requests
@JoeWatkins quick question btw, how do you reload code?
 
@FlorianMargaine remaining issue is that we cannot import the SAPI specific things. Only extract the env. But e.g. not import SAPI specific functions.
 
@Danack you still need to either act as an fpm worker or bootstrap/spoof the variables/environment to be able to debug web requests
 
3:16 PM
@Tyrael variables and env we can import via phpdbg. wait command.
 
and there are still many apps with hard dependency on apache(with .htaccess)
I know
 
@Tyrael that's why we don't import the ini files but the ini settings
 
user895378
@bwoebi Again ... this is really easy to do with my standalone server. It's all possible ...
 
but it means that you have to bootstrap and that is obviously harder for the average user than to use xdebug
 
@Tyrael I would not call those "hard dependencies"
 
3:18 PM
you have to modify your app or bootstrap around it
if you want to be able to debug that app in phpdbg
but I'm not trying to look phpdbg bad
just stating why I think that xdebug will stick around
"@Danack I don't think it will be replaced until there is out-of-the box support for debugging web requests"
 
@Tyrael I don't get your issue. an IDE just can issue the wait command internally? And for IDEs, xDebug depends on an IDE anyway, so…
 
so you are saying that an IDE could be able to bootstrap an app without user interaction?
not technically being able, but actually could figure out how to bootstrap an app to execute it properly?
 
that's exactly what phpstorm is going to do afaik
 
well, you do the request in your browser, just like you'd with xDebug. Then phpdbg will intercept the request from the web SAPI, import it into it's own environment and execute it. Then feed the outputs back to the web SAPI.
And the IDE just needs to invoke phpdbg and issue the wait command. That's all.
 
user895378
^ trivial.
 
3:24 PM
I see. but that still won't cover stuff like properly setting SERVER_NAME or PHP_SELF, right? how do they handle that?
the bootstrap which would otherwise happen in the SAPI
 
@Tyrael It will. It imports the global symbol table too.
 
where do they get that info?
oh
I missed part of your previous reply
thats clever
 
@rdlowrey Small bug - doesn't seem to crash anything: "PHP Notice: Undefined index: tcp://api.github.com:443 in /vendor/amphp/artax/lib/SocketPool.php on line 123"
 
@Tyrael if you want to have a look what's all exported: lxr.php.net/xref/PHP_TRUNK/sapi/phpdbg/…
 
how do you interact with the web SAPI?
 
3:26 PM
@Tyrael unix domain socket + extension
 
(should have checked out the source)
 
The extension is a small thing which can be always loaded with no real perf impact.
It really just exports env and later displays result
 
@rdlowrey Not so small bug: "Notice: Undefined property: Amp\Artax\SocketPoolStruct::$socketId in /vendor/amphp/artax/lib/SocketPool.php on line 259"
 
@NikiC depends how you define ugly
 
@Tyrael you now got the potential?
 
3:33 PM
@rdlowrey btw Shall I switch to using dev-master, to avoid the RC number escalating too much?
 
user895378
@Danack nope, I force pushed an amended commit/tag.
 
user895378
@Danack There is a 1.0.x-dev branch alias for master though, FYI.
 
@rdlowrey Ok. btw I just realised a feature request that may be useful (at a later date). Currently it seems Artax is processing the requests in order that they come in. It could be good to make the order be settable. That would help people who are doing web crawlers do a depth first trawl, rather than width first trawl. And similarly for me would prioritise downloading the actual zip files rather than gathering all the information first.
 
user895378
@Danack I have no idea what you're suggesting :)
 
user895378
If you want them in a different order just change the order in which you call $client->request($uri); ?
 
3:37 PM
fifo vs lifo.
 
user895378
Oh, you mean for queued requests. Okay. Well that's easy. I can do that option now if you like.
 
DO IT NAO!
 
While I can use boolean flags, is there an elegant way to flush the remainder of an iterator through a generator function?
foreach ($iterator as $key => $value) {
    if (someCheck($value)) {
        continue;
    }
    // yield the rest of the iterator
}
Should I just manually invoke the iterator methods, sans-rewind?
 
I don't understand what you want to do, sorry
 
@bwoebi is the extension part already available?
 
3:40 PM
@DanLugg I can't see any
 
so you would need to enable that for your web sapi install, then phpdbg can hijack those requests after the bootstrap, right?
 
For clarity:
foreach ($iterator as $key => $value) {
    if (someCheck($value)) {
        continue;
    }
    foreach ($restOfTheIteratorWithoutRewinding as $key => $value) {
        yield $key => $value;
    }
}
@ircmaxell Should I just manually iterate via current(), etc.?
 
you *could
$iterator->next();
while ($iterator->valid()) {
    yield $iterator->key() => $iterator->value();
}
 
^^ Yea.
 
@rdlowrey I can't change the order in which I submit requests that easily without rewriting everything to i) get one set of requests, ii) order them myself, iii) submit them to be processed. But if I can say to artax, 'prioritise the most recently submitted request' then it would change the behaviour of the app. Currently it is getting all the information about all the repos first, and then starting the zip downloads.
Prioritising the most recently submitted requests would make the zip downloads happen before some of the 'get info about a repo' request, which would mean fewer requests would be active at once.
That would also be useful for people writing web-crawlers, to avoid too large an explosion of requests, by doing depth first retrieval.
 
3:44 PM
@Tyrael yes.
@Tyrael and yes.
@Tyrael --enable-phpdbg-webhelper
 
@tereško A native version of an API something like pastebin.com/CbYKC9b2 would be more suitable IMO (sorry for ridiculously late ping, work/general RL came up)
 
@bwoebi can you come irc a minute
 
foreach ($this->iterator as $key => $value) {
    if ($skipWhileFunction($value, $key)) {
        continue;
    }
    while ($this->iterator->valid()) {
        yield $this->iterator->key() => $this->iterator->current();
        $this->iterator->next();
    }
    break;
}
@ircmaxell Reasonably elegant, I'd say. Better than handling flags.
 
I don't know. Seems like it repeated itself
 
@JoeWatkins ok
 
@Tyrael ;-D
 
seems a bit hackish
 
Something hackish in PHP?
 
dear god
 
@Tyrael that was needed for krakjoe/phpdbg. I can change that in phpng.
 
3:50 PM
what are we, haskell?
 
foreach ($this->iterator as $key => $value) {
    if (!$skipWhileFunction($value, $key)) {
        break;
    }
}
while ($this->iterator->valid()) {
    yield $this->iterator->key() => $this->iterator->current();
    $this->iterator->next();
}
@DanLugg ^^
 
eiw
 
@DanLugg This simply skips n then yields the rest?
 
3:51 PM
does same thing, avoid misleading nested loop
 
@LeviMorrison Yea.
 
hm
I don't know yield .. => ..
 
@DaveRandom sure. But it still would be a nice syntax sugar. Hell you can do array merging with much less code natively =P
 
@DaveRandom Meh, I dunno if it's misleading. But yours is broken into two distinct steps
I do like that.
 
function iterator_skip(\Traversable $t, $n) {
    $i = 0;
    foreach ($t as $key => $value) {
        if ($i++ < $n) {
            continue;
        }
        yield $key => $value;
    }
}
^ Actual code
Ah, you are using a predicate to determine how much to skip
Seems... strange.
 
3:54 PM
$doYield = 0;
foreach ($this->iterator as $key => $value) {
    if ($doYield |= $skipWhileFunction($value, $key)) {
        yield $key => $value;
    }
}
I'm sorry
 
@LeviMorrison Yea, it's predicated not counted.
 
@DaveRandom get out
 
@LeviMorrison return new LimitIterator($t, $n)
 
Oh wait that wouldn't work anyway
You'd have to do $doYield = $doYield | $skipWhileFunction($value, $key)
 
@ircmaxell LimitIterator is like a limit in SQL, not like a limit used in anything else.
So I don't use it.
 
3:55 PM
Actually you could just use a logical or for it as well, in that case
 
@DaveRandom You mean $doYield |= $skipWhileFunction($value, $key)
 
@LeviMorrison huh? it solves this use-case explicitly
$iterator, $offset, $count = -1
 
@ircmaxell public __construct ( Iterator $iterator [, int $offset = 0 [, int $count = -1 ]] )
 
@bwoebi Not in this case, wouldn't work in an if, would always take the value of the rhs
 
@DaveRandom wrong.
 
3:56 PM
It has a skip, and a limit. That's not a limit as defined by any other functional use I've seen.
 
@bwoebi orly?
 
Limit in other functional contexts only limits; it doesn't skip.
 
@DaveRandom you always are returned the assigned value.
 
@LeviMorrison fair, but you can abstract that with your limit function
point being, you don't need a generator to do it
 
@LeviMorrison I handle this by just firing up skipWhile anyway
public function skip($count)
{
    return $this->skipWhile(function () use (&$count) {
        return $count-- > 0;
    });
}
 
3:57 PM
php -r '$a = 1; var_dump($a |= 2);'
int(3)
 
return $count --> 0;
 
@DaveRandom ^
 
@ircmaxell LimitIterator as defined by PHP is just a composition of skip and limit, which is what I would much rather do.
 
@bwoebi Huh. I wonder where I got that idea from, then.
 
3:57 PM
@FlorianMargaine lol, I think there was an SO question about that; like: "What's the long arrow operator?"
 
@DanLugg yep
 
function skip(\Traversable $t, $n) {
    return new \LimitIterator($t, $n);
}
function limit(\Traversable $t, $n) {
    return new \LimitIterator($t, 0, $n);
}
 
@DanLugg So once you get the first false value from your predicate you yield the rest, yeah?
@ircmaxell You don't get it. I don't want to use the SPL iterators at all.
 
3420
Q: What is the name of the "-->" operator?

GManNickGAfter reading Hidden Features and Dark Corners of C++/STL on comp.lang.c++.moderated, I was completely surprised that it compiled and worked in both Visual Studio 2008 and G++ 4.4. The code: #include <stdio.h> int main() { int x = 10; while( x --> 0 ) // x goes to 0 { prin...

 
@LeviMorrison Correct.
 
3:58 PM
eoh
 
@LeviMorrison why?
 
@FlorianMargaine Because I'm designing a new, alternative SPL ^^
 
@FlorianMargaine The "down-to" operator ;-)
 
@LeviMorrison oh, ok
 
@DanLugg What's the use-case for this? I've never seen a real need but have seen multiple libraries provide this.
 
4:01 PM
@LeviMorrison skipWhile/takeWhile?
 
Yeah; I've never seen a need beyond the simpler skip_n/take_n
 
Use-cases are limited, I had one in a project (.NET, as it's Enumerable supports it too) awhile back, I'd have to dig it up.
However, it does make it clean and easy to implement skipN as demonstrated ^^ :-P
 
@DanLugg I hardly think this is "clean" and "easy" but I do buy the flexibility argument ^^
 
I never said it was flexible ;-)
 
I meant that skip_while can be used to implement skip_n, therefore skip_while is more powerful.
 
4:11 PM
Yes, certainly. That's apparent by the simple fact that skipWhile is predicated, whereas skip isn't.
 
user895378
@Danack How do you feel about an API like the following?
 
user895378
$client->request($uri, $options = [
    Client::OP_REQUEST_PRIORITY => 50, // 1 - 100 using 50 as the default if not specified
]);
 
user895378
And using a priority queue for the requests?
 
user895378
That way if you ZOMG NEED THIS ONE DONE RIGHT NOW then the client will handle that for you ...
 
user895378
That might be a v1.1 feature ...
 
4:19 PM
@rdlowrey That would solve my problem but I think I prefer in general the ability to push things to the end or start of the queue of things to be processed. I only have three different things to download (repos, tag lists and zip files), so it's easy to prioritise them, but if you were crawling a huge web site, then all of the requests would be of the same type, but you'd still want the most recent ones to be processed first.
And yeah 1.1 - lets get a working version first.
Did you see the little typo issues?
 
user895378
@Danack yeah I force pushed fixes and the same tag so they should be gone upstream
 
Attention all germans. @NikiC @Gordon and others. I am working on a shit system and I need to add Düsseldorf somewhere. php -> flash -> Düsseldorf
However the stupid flash thing doesnt understand your ü character
 
@rdlowrey I can't see a commits after "Correctly reuse existing connections under high load"
 
Do you guys have some alternative like ß -> ss ?
 
user895378
@Danack because I amended and force pushed
 
user895378
4:21 PM
so there won't be a new commit
 
@PeeHaa ü -> ue, ä -> ae, ö -> oe
 
@bwoebi Is that somewhat accepted?
I.e. can I get away with it :P
 
yep
 
tnx!
 
Ah, ok. I'll try deleting caches and vendor directories to force an update.
 
user895378
4:23 PM
@Danack Sorry, I know it's bad to force push but when something stupid like that shows up within two minutes of the push I hate to clutter the history
 
4:42 PM
@Tyrael #phpdbg if you have a minute ?
 
git.php.net/?p=php-src.git;a=shortlog < I somehow did a bad merge. Things now are twice in history. (Nothing went wrong in source, but history is a bit fucked^^) It's so easy to fuck up git …^^
 
da fuck
none of the "frontend devs" in this fucking company knows that you can pass functions as parameters in JS
 
for seriously?
 
yes
 
@tereško wait. Is JS frontend?
 
4:50 PM
@tereško none of the frontend "devs" in this fucking company knows that you can pass functions as parameters in JS
 
the question I asked them was "are all browsers using the same order of parameters in object ?"
after several "why do you need that?" levels I ended up lecturing them on how to use apply(), call() and bind()
 
@DaveRandom My wife is away again. Can you cook for me? :(
I've survived so far on bags of crisps and microwave pizza.
 
you can always order sushi
 
@Fabien Put the crisps on the pizza.
 
@DanLugg I gotta ration!
 
4:56 PM
@Fabien Put half the crisps on half the pizza.
 
@tereško Sushi an expensive take out over there? It is here.
 
I tend to order them for ~25€ in total (that's about 6x8) .. there is a 20€-something minimum for free delivery
 
Sounds about the same
 
posted on October 28, 2014 by kbironneau

/* by guitarranalon */

 
5:17 PM
ok , I have had enough
time to go home
 
@Fabien Who the hell puts a pizza in the microwave???
 
@DaveRandom I DO! I love it
 
It goes all soggy and rank
 
yeah
I love it
 
@Fabien I recommend this if you want something quick and easy (I usually just grill the salmon and use the marinade as a pour-over sauce for speed, I also usually double the sauce:salmon ratio, but I also use insanely big pieces of salmon from Costco).
Do it with rice and steamed veg
Turns out that a bunch of recipes for children and pregnant women are really nice
Some of them are also rank though so be careful
 
5:24 PM
Dear Room 11, I am thinking about changing instanceof to always return false for non-objects. Currently, array instanceof \Something will return false, but basically all other non-object types give a fatal error. Thoughts? Especially any concerns?
/cc Internals; @ircmaxell @NikiC @bwoebi @rdlowrey @DaveRandom
 
Veg? Yuck.
 
@LeviMorrison Wait, it doesn't do that already?
 
I have an addendum for @LeviMorrison's proposal:
 
@LeviMorrison do it. I absolutely thought that'd already return always false.
 
I'm +1 on making it do that if it doesn't do that already
 
5:28 PM
Quite notably, null instanceof \Iterator gives a fatal error.
 
$var = 1;
var_dump($var instanceof PDO); // bool(false)
 
($arbitraryExpression instanceof $classNameLiteralOrStringExpression)
^^ Should be valid.
 
@LeviMorrison Oh wait, you're testing literals, that's a parse error
which I had a conversation quite recently with someone about, and yes they also should return false
 
@LeviMorrison Uh. Null should be instanceof any class. An empty set is always part of any other set.
 
Even though they don't actually make sense, they are still a valid expression
 
5:29 PM
@bwoebi No, it's not an instance of any class.
 
Set theory dictates it should be, but practical implementation would explode if that were the case.
 
People use instanceof to determine if it is safe to call methods.
null is not an instance of anything.
 
@LeviMorrison from that POV yes.
 
It's the absence of something.
 
The better questino is, what should be invalid? ($expr instanceof 42) or other non-string, non-object expressions on the right.
 
5:31 PM
@bwoebi Even if you want to think in terms of sets, you've got them the wrong way round...
it's not checking that the first term is is a sub-set of the 2nd term, it's that the 2nd term is a sub-set of the first.
 
@DaveRandom Yeah, I guess it only fails for literals. Variables seem to work: 3v4l.org/tLJPh
 
@Danack yea… true.
 
@LeviMorrison 3v4l.org/OvPXi
Which is good, but I expected that to fail too (for some reason)
 
@Danack Good point.
Well, good, this simplifies some code of mine.
 
flex
 
5:34 PM
I checked literals and they failed and I was ing
function to_iterator($in): ?\Iterator {
        $iterator = null;
        if ($in instanceof \Iterator) {
                $iterator = $in;
        } elseif (instanceof \Traversable) {
                $iterator = new \IteratorIterator($in);
        } elseif (is_array($in)) {
                $iterator = new \ArrayIterator($in);
        } elseif (is_string($in)) {
                $iterator = string_iterator($in);
        }
        return $iterator;
}
 
@LeviMorrison It arguably shouldn't fail, it's a valid operand-operator-operand expression, but since it doesn't make a whole bunch of sense to check whether something that's definitely not an object is an instance of a class then it's not really important to fix it (and I suspect it would meet some resistance on internals for this reason)
 
Since variables that have those types works I'm okay with leaving it.
It was just a shocker when I tested literals and they failed.
 
I had the same thing recently, I think I was talking to @DanLugg about it at the time (couple of weeks ago)
 
^^ T'was true.
 
Since when can namespaces start with ? … With class_alias() I can define such classes, but since when is ?\Iterator a valid class name for the parser?
 
5:40 PM
@bwoebi It's not.
It might be valid with nullable types.
 
oh.
I noticed the return type hint, but that nullable typehint looked for me like a namespace called ? :-/
 
I really wish it could go after the type: \Iterator?
 
Because we're not bound by constant case expressions, for syntactic simplicity, perhaps we could make the switch expression optional, which defaults to true.
 
bowerphp.org <-- they're using the php.net favicon (!!!)
 
switch {
    case $someExpression1: someOperation1();
    case $someExpression2: someOperation2();
    case $someExpression3: someOperation3();
}
 
5:43 PM
@DanLugg I would like this, but people shout at you for doing switch(true) and give a bunch of arguments I don't understand
 
@LeviMorrison +1
 
I guess it can go after the type if we don't let ?> ever show up next to each other.
(like in generics)
@DanLugg I think we'd have a more likely chance to remove expressions from case statements ^^
 
@LeviMorrison Yar, harhar.
;-)
switch with ($object instanceof case) {
    case MyClass1: someOperation1();
    case MyClass2: someOperation2();
    case MyClass3: someOperation3();
}
Even better :-D
 
@DanLugg ლ(ಠ益ಠლ)
 
lol
switch with (42 + case === 45) {
    case 1: ...
    case 2: ...
    case 3: ...
}
:19651719 Is Was that like.. a circumcision taking place?
Ah yes, I recall this.
 
5:53 PM
 
@ircmaxell Cruel and hilarious.
 
6:06 PM
I'm getting a ton of traffic on my Agile post, but I can't tell from where (none has the referrer set)
 
6:26 PM
I think it's sad that /r/lolphp is a more kind and accepting place than /r/php
3
 
@ircmaxell I'm not sure why this persons sits on r/php; they have moved on to other technologies and have no interest in contributing to PHP.
 
@LeviMorrison I'm not sure. I feel like someone writing $int instanceof Foo is likely a mistake on behalf of the programmer and it might be beneficial to notify it. I can see why you'd want to drop the error (after all "is $int an instance of Foo?" has a pretty clear "no" answer), but I'm not convinced that this is really helpful.
 
@NikiC Turns out it already returns false if it's a variable; it just fatals on constants. I don't think I'll propose a change given that realistically checking 1 instanceof \Foo is in no-way helpful in real code.
 
@NikiC 3v4l.org/sgIK7 <-- that's not the error
 
I'd like it to not fatal but not enough to propose anything. I figured since literals didn't work when array literal did that the behavior was just all foobar.
I was wrong, thankfully.
 
6:34 PM
if that was an error, my code would be seriously fubar
as I rely on that often
 
@LeviMorrison Oh, okay :D
Well, then I've been talking shit there ^^
 
Apparently I was too ^^
 
then again, my code is seriously fubar anyway, so :-)
 
@Gordon Nope, just following along with the tweets on twitter :-)
 
6:52 PM
@LeviMorrison And it can't?
 
@NikiC Maybe.
 
user895378
@LeviMorrison woah I just assumed that already happened. I would be in favor of false in that scenario.
 
If we have generics (who know?) then Vector<Type?> could be problematic.
Because of ?>
 
@rdlowrey it turns out that it indeed already works that way, false alarm ;)
 
Yeah, it works on variables, just not literals.
 
6:53 PM
@LeviMorrison So could Vector<?Type> because of <? ^^
 
@NikiC ...except you are already in a "preprocessor" so it doesn't matter.
If you think Vector<Type?> is just as doable then I'm game to try it.
 
@LeviMorrison yeah actually, you're right about that one
@LeviMorrison nope, a lot less doable ^^
 
user895378
@NikiC oh good :)
 
@NikiC "less doable" or "impossible"?
 
@LeviMorrison less doable to the point of being impossible ^^
 
6:57 PM
"impossible"
 
Depends how you parse it; if you get the contents of <? to ?> first, then yeah impossible.
But if you just switch modes when you hit <? you could just make the ?> rule context sensitive.
 
yeah, I mean if we continue to maintain lexer parser separation. if the lexer can depend on parser state it isn't much of an issue
 

« first day (1473 days earlier)      last day (3491 days later) »