« first day (1304 days earlier)      last day (3644 days later) » 

12:21 AM
@webarto It's in PHP 5.3+
From another place I frequent:"Be careful using \n in C#; it's "platform specific line terminator", not 0x0a." "Yes, it's true in C/C++ as well."
WHAT THE FUCK.
 
\n is the only EOL you should be using.
Also, it's the same thing.
a = 10 = New Line = \n
Right?
\r is carriage return
 
For me yes - but other people were saying that C++ might print \n as \r\n on windows. I think they must be high.
 
12:39 AM
They've confused it with PHP_EOL :P
 
in firefox in my script, when I go back it says "Document Expired" or "This document is no longer available.". Does anyone why this is happening and how to fix it? I am using sessions in my php script
 
@user3291093 You're making a post request to something. You can't repeat post requests.
 
yes i am
but is there a fix to it?
 
Chrome
 
beside using another browser :p
i know it works fine on safari too
 
12:47 AM
You're doing it wrong, you're launching 2 requests anyways.
I mean, it shouldn't work...
 
so what you are saying is that i have 2 form's posting
on one page?
 
Your code should be doing a post-redirect-get. Which should make the back button work....mostly. Because you're seeing 'document expired' it implies that you're not doing post-redirect-get
 
can you check my website... asiraj.com
 
@user3291093 No, that you can't go back to a page that was shown as the result of a post
No - I will not check your website.
 
but i have seen people not get that message
although they are using post
 
12:57 AM
> since then the team has been rolling out small and sensible updates
AKA, "Levi Morrison" has been rolling out small and sensible updates.
^^
@JoeWatkins Thanks for the ping.
 
morning
 
Getting 502 on nginx for phpng, normal?
 
1:15 AM
@webarto Probably just a permissions thing.
 
@Danack Doesn't look like it, even set to root user.
Just "upgraded" from 5.6 beta 2. That worked.
 
Strace all the things.
But me right now:
 
Yawn... I think I hate writing exercises =_=
 
1:46 AM
anyone here worked with twitter api?
 
yeap, ages ago
 
@JoshC. Not since you asked 6 hours ago.
 
well im looking at this github files for it. and when setting up the settings it askes for oauth access token and it asks for consumer key where do i fid the consumer key
 
Oh, you might want to read up on that - they even have a tutorial for it afaik
 
@Ocramius If you can't fix it, fix it, fix it - I don't care that much. tbh code parsing/generating probably has to be done through something complicated, i.e. Nikics brainfuck-like parser.
 
1:51 AM
@Danack I agree with that, but it becomes really unusable
I think it probably shouldn't apply alignment to reflected code :|
That video just got bookmarked :D
 
2:21 AM
I make my class allocate and free without crashing ... like a God!
 
@Jack Are you sure you code was called? That often happens to me "Yay! It didn't crash! Oh wait, it didn't get triggered.".
@Ocramius fyi that issue isn't urgent for me - I can just avoid using heredoc.
 
2:37 AM
@Danack still a bad bug :P
 
@Danack Pretty sure :) it was giving out memory leaks before heh
 
I love it how the first comment derailed the whole argument lol
@LeviMorrison I think most of the internals would agree, but from what I understand the patch that Bob proposed would be too high maintenance ...
I've been told that this would be somewhat easier with other parsers ... but I don't see that change any time soon.
 
I've written a few small parsers by hand and honestly it isn't too had.
The bigger problem is we don't have clean breaks between our parser and executor.
 
How did it go with the static closure bug?
Any breakthrough?
 
It should be architectured so we could be able to swap out front-end and back-end pieces.
@Jack It's 'finished'.
 
Oooh
 
3:06 AM
The problem is that so far I haven't found anyone who really knows how it should behave.
Want the details?
 
lol
Eh sure :)
 
A S T , Its easy as
1 2 3 , as simple as
do re mi, AST, 1 2 3
baby you and me girl
AST all the things!
 
^^
First, the obvious example:
class A {
    function foo() {
        $f = function() {
            return $this;
        };
        return $f();
    }
}

class B extends A {
}
$b = new B;
var_dump(get_class($b->foo()));
You definitely expect string(1) "B".
 
Yep
 
When the $this pointer is set it all behaves logically and as expected.
So... what about when there isn't a this pointer?
 
3:09 AM
Static away!
 
class A {
    function foo() {
        $f = static function() {
            return static::class;
        };
        return $f();
    }
}
class B extends A {
}
$b = new B;
var_dump($b->foo());
Here you'd expect string(1) "B"
 
So, because of the static closure, it doesn't bind to a particular instance.
 
Right, you expect late static binding.
 
Yes, let's assume that.
 
This one is pretty obvious and fix is easy.
So... what about this one?
 
3:11 AM
This is the op_array fix, right?
 
class A {
    static function foo() {
        $f = function() {
            return static::class;
        };
        return $f();
    }
}

class B extends A {}

$b = new B;
var_dump($b->foo());
We have a non-static closure in a static method. What do you expect it to output?
 
Alright, so you're calling a statically declared method as an instance method.
So there's no $this available ... technically ... but it might still return B in this case :)
 
Currently it resolves to string(1) "A"
Even when applying the fix for the previous bug you still get string(1) "A".
 
Why is that?
 
A closure has two pieces when talking about binding: scope and $this.
When $this exists it is the scope.
 
3:14 AM
That's fair.
 
When you don't declare it as static I'd argue it uses the defining scope, not late static bound (like self)
So you'd rightfully get string(1) "A" because you used a non-static closure. There's no late binding because it isn't static.
 
Yeah, but it's inside a statically declared function.
 
But that certainly isn't very intuitive. Most people don't even know that static closures even exist.
So that is the other option: automatically promote it to a static closure.
 
Static closures ... the new favourite interview question =D
 
I hate LSB; I really do.
 
3:17 AM
It's rather tricky, indeed.
 
Between the two options promoting it to a static closure is probably the intuitive behavior which has merit.
But it removes a feature that technically already exists.
 
You mean the static function() declaration?
 
I mean this providing string(1) "A":
7 mins ago, by Levi Morrison
class A {
    static function foo() {
        $f = function() {
            return static::class;
        };
        return $f();
    }
}

class B extends A {}

$b = new B;
var_dump($b->foo());
I think now that I've thought about it more I'm going to go with the promotion route.
 
You would get my vote :)
 
The clear answer in my mind is: remove all LSB from the language ^^
That abomination should have never been allowed.
 
3:21 AM
hehehe
 
^^
So here's why it should 'promote', in my opinion:
 
I do use LSB on a few occasions.
 
(or as I currently think)
::foo() is the context that is actually creating the closure.
::foo()'s context is dependent on the caller.
So when you do B::foo() the active context for creating the closure is B.
 
How come Dmitry tested WordPress when --with-mysql fails to compile?
 
So even though the closure isn't static it doesn't matter; it's current scope is B and not A.
How does that sound?
 
3:23 AM
@LeviMorrison Yep, makes sense.
@webarto E_MAGIC
 
Logic is sound?
 
Yup .. are you proposing this to internals?
 
No, I'm opening a PR.
In my mind this is clearly bug fix material and I'm lucky because we're about to release 5.6
So even if I break behavior it is at least on a minor release and not an a bugfix release ^^
 
Hehe, good stuff =D
 
neat :P
 
@LeviMorrison This may cause issues in C89.
Declarations should be the first statement after an opening brace.
 
Really? I thought they had to just be on function level.
(Not in an inner block)
 
Some compilers are more permissive on that.
 
Also... how do you guys feel about this? 3v4l.org/Da6t0
 
vomits in mouth
 
3:38 AM
I mean, check out that static to line ratio!
 
Sadly, it errors out heh
 
18 lines of declarations and 9 statics?
I'm not going to propose that as a feature request but I'm saddened a little bit that it doesn't work.
 
Yeah, you need classes for static:: to work :)
This would all be different if PHP was more like JavaScript, where this would always work.
 
3:52 AM
@Jack So I figured I'd define some macros.
#define FUNCTION_IS_STATIC(closure) (   \
    (closure).common.fn_flags & ZEND_ACC_STATIC)    \
)

#define EX_IN_STATIC_CONTEXT() (    \
    EX(prev_execute_data) \
    && FUNCTION_IS_STATIC(*(EX(prev_execute_data)->function_state.function))    \
)
This is inside Zend/zend_closures.h.
Are there some conventions I should be following?
It looks like maybe IS_FUNCTION_STATIC instead.
IS_STATIC_FUNCTION is probably better.
 
Yes to the last iteration :)
 
Now... where to put it?
 
17 hours ago, by user3622030
0
Q: What i have to do when i or my people are discriminated in chat room?

user3622030i came to php chat room http://chat.stackoverflow.com/rooms/11/php and was going to socialize eventually. but then i came across a post discriminating my people "turks" calling them "homosexual turks" http://chat.stackoverflow.com/transcript/message/16388277#16388277 to what i replied begin from...

this guy
 
@LeviMorrison You're using this code inside zend_vm_defs.h right?
 
4:06 AM
@BoltClock What about him?
 
But IS_STATIC_FUNCTION could be used all over the place (77 instances according to grep)
 
@Jack I just noticed this discussion. How could I have missed it
It would have been entertaining to watch
 
"Entertaining" would be one way of describing it :)
His tirade came out of nowhere, 12 hours after the fact iirc.
@LeviMorrison Ehm?
 
Not sure what you are confused about..?
 
Wait, so you want to rename an already defined constant definition?
 
4:10 AM
Not sure what you are saying?
Oh, no, this macro doesn't exist
 
Let me put it differently then, what did you grep for?
 
But it could exist and has 72 instances where it could be used.
 
Oh, you searched for that code excerpt .. gotcha
 
grep -r 'common.fn_flags & ZEND_ACC_STATIC' > is_static_function_candidates.out
 
yeah, slow morning heh
If you would call it IS_STATIC_CLOSURE(closure) it would seem logical to add it inside zend_closure.h.
 
4:13 AM
Even inside of the code for closures it would be used on non-closures.
 
Ah
Hmm, where is zend_function declared :)
 
Zend/zend.h
ZEND_ACC_STATIC is in Zend/zend_compile.h
Ah, I was wrong; zend_function is also in compile.h
 
> /* A lot of stuff needs shifiting around in order to include zend_compile.h here */
hehe
Well ehh, zend_compile.h seems rather attractive but I'm not sure whether all those other candidates actually include it.
 
How about just after ZEND_ACC_STATIC in zend_compile.h?
 
Hey, there's a thought!
 
4:22 AM
@Jack
ext/reflection/php_reflection.c
ext/spl/php_spl.c
Zend/zend_API.c
Zend/zend_closures.c
Zend/zend_compile.c
Zend/zend_execute_API.c
Zend/zend_object_handlers.c
Zend/zend_vm_def.h
Zend/zend_vm_execute.h
Those are the files that would use it.
 
Out of all those, spl seemed the least likely candidate :)
Gotta say, that looks pretty cool!
 
4:44 AM
anyone worked with getting profile information from social media?
 
5:04 AM
Anyone know what the difference between op_array.fn_flags and common.fn_flags is?
Jack, do you know?
 
6:02 AM
I can only make a guess that common.fn_flags is the declaration whereas op_array.fn_flags is during execution.
 
same things
common exists so that a zend_function can be cast to an op array or an internal function
function->common.fn_flags == ((zend_op_array*) function)->fn_flags
 
Interesting.
 
@JoeWatkins Do you have some time to entertain a php-src question on variable deallocation? :)
 
good morning
 
@Jack I do yeah
 
6:17 AM
So I'm using ZVAL_NEW_ARR() but it seems that the corresponding zval_ptr_dtor() on it doesn't clean up the whole thing.
 
if this ng ?
 
Yeah :)
Oh .. perhaps I was supposed to just use ZVAL_ARR() ... nope
 
try zval_dtor
 
anybody worked with XMPP for android?
 
@JoeWatkins Nope, same effect actually.
 
6:23 AM
show me more code
 
It seems that zend_is_callable() leaks too ...
Code goes like:
 
I'm not too sure of my way round this maze of i_zval_do_things and _zval_do_things yet
 
ZVAL_NEW_ARR(&params);
array_init(&params);
...
zval_ptr_dtor(&params);
 
array_init does ZVAL_NEW_ARR
 
=.=
Now, why would it do that ...
My bad, then :)
 
6:26 AM
because there's no MAKE_STD_ or ALLOC_INIT step anymore, you don't expect to be working with a pointer ....
so just array_init then add_assoc, mucho simpler I think ...
 
Actually, I only added array_init() because it crashed if I left it out.
But then why would anyone use ZVAL_NEW_ARR() for anything ... oh well
Hurray!
 
well engine does use arrays/tables for other things, array_init makes ready for userland that structure I guess, you might want to otherwise initialize with different dtor/size/whatever if you're doing something non zval/non refcounted/whatever ...
 
I suppose that makes sense then :)
The last leak left happens here
It says "Overflown by 1 bytes"
ZVAL_STRING(&func, "hash_hmac");

    if (!zend_is_callable(&func, 0, NULL OAUTH_IS_CALLABLE_CC)) {
That's how I call it.
The func zval gets discarded afterwards.
 
monrnin'
 
hm, what happens if you do not discard the zval ?
morning @tereško
 
6:32 AM
good question .. let's see
 
all this tolower stuff has to be hurting us ... it should be removed, lets have the lowercase name as arKey in common, that would make much more sense ...
 
@tereško morning. have few minutes?
 
It went from 2 memory leaks to ... drum rolls 3 memory leaks heh
 
okay, good ...
 
@AlmaDo not at the moment, I am about to ride to work
check back in ~30 min
 
6:33 AM
not sure, but I've used is_callable elsewhere and it didn't behave strangely ...
so I'm not sure there can be a bug in it ... but don't think there was any difference in api ...
 
Hmm, doesn't hash have an API?
Diff question altogether.
 
hash ?
 
Yeah, hash_hmac() and family.
This particular extension uses it internally.
But it does so by using call_user_function().
 
it does have api
http://lxr.php.net/search?q=&defs=&refs=&path=ext%2Fhash&hist=&project=PHP_TRUNK
php_ prefixed headers contain exported api functions
 
Good, morning!
 
6:37 AM
Hmm, time for a rewrite then ... :)
Could it be that I'm passing NULL for callable_name btw?
 
possibly, i do that in a few places elsewhere but am sure it is not used
otherwise I do usually just free it ... pain ... maybe that can be updated to use zend_string now
 
@tereško ok. Please, take a look here - I've put my question there with whole description. Thanks!
 
@JoeWatkins Hmm, still get this as output.
 
it hates you, pretty obvious ...
 
Yeah ... I feel properly hated, alright
 
6:40 AM
ping dmitry in php.pecl or keep at it with debugger, turn zend alloc off, try all the normal things, I don't know ...
 
@AlmaDo If the case is as simple as Comparable, I'd do it all in the same interface.
 
it'll be easier to trace if you turn zend alloc off I think ... there could be a bug in it, maybe pinging dmitry should be first course of action in this case because new ...
 
@SecondRikudo ? So all methods there => lot of duplication?
 
Because it's possible that not all isLess will use isGreater and isEqual.
For example, I may consider two cities equal if they size is approximately the same, but one is larger or smaller based on the number of citizens
their*
 
> Hi Joe,

I would definitely help you with this proposal and its integration with
opcache, but I would postpone it a bit.
At first, I'm currently overloaded with phpng related tasks.
At second, I think we should implement typehinting at the moment when we
may really benefit from it (using JIT).
Otherwise, we may make us more troubles in the future.

Thanks. Dmitry.
 
6:43 AM
In that case, isLess cannot use isEqual, and isGreater is only part of the solution.
 
Yeah, thanks for your support, Dmitry. Let's just forget that this RFC is probably going to be an overwhelming landslide but you don't want it because it breaks opcache.
Appreciated.
 
I can rewrite it without dmitry ...
 
@SecondRikudo may be so, but .. hm, then it breaks transitivity
 
@AlmaDo The point of an interface is not (only) to prevent code duplication.
It's to provide a contract.
 
@JoeWatkins In my opinion it really shouldn't need to be rewritten. Altered a tiny bit at worst.
 
6:45 AM
If you expect an implementing class to be able to do isLess, it should be in the interface. If not, it should not be.
 
@SecondRikudo yes, not only. But in my case I know it will be transitive comparison
 
It's a sign they've done something really stupid in there.
 
interfaces are there for the conceptual part of your app, not the implementational.
 
public function >($a, $b) { ... } hehe
 
@SecondRikudo thus, the question is still there: in my case, I am sure that isGreater === !(isEqual) && !(isLess)
 
6:46 AM
but hey this might be a good thing, the other day he was talking about not pursuing a jit at all, not releasing the code for it ... if this is the thing that makes him see that it is actually worth his time then we get a jit and return type hints, and we don't have to do strange things like string comparisons instead of class lookups ...
 
@AlmaDo Who do you expect do this operation?
The caller class which will use your Comparable? Or the comparable itself?
 
@SecondRikudo what does that mean "who"
 
@AlmaDo I highly recommend you destroy that interface.
 
@SecondRikudo it will be used in many things, I'm not sure for now yet
 
I build Ardent with Comparable to begin with.
 
6:47 AM
@LeviMorrison ok, explain please
 
It severe limits what kinds of things you can store in the containers.
Notably, primitive types and third party code.
Instead ask for a callable that does the comparison.
 
I'm still not sure why should I destroy it. In my case there will be different metrics (all transitive, however) - thus it may be justified to have such interface..
 
It isn't.
 
ok, why
 
Look at the entire C++ stl.
Do you see Comparable in there at all?
No, you see it take functions to do the comparison instead.
 
6:50 AM
I have to idea what C++ stl is..
 
It's far more robust.
 
@LeviMorrison anyway, it's up to you, your RFC, I think @ircmaxell had a solution to the opcache compatibility problem, and if that doesn't work we can do-over the patch, there's another way ...
 
@AlmaDo Standard Library.
 
Alright, it's 1:00am here. Going to bed.
 
@SecondRikudo yeah, I've guessed that. Still too far to "look there". how can I enforce proper callable? How can I enforce the contract then?
 
6:51 AM
nite @Levi
 
nite
 
@AlmaDo Well, how do you enforce isEqual to do what you want it to do?
You can't, you expect the guy making a class implementing your interface to not be an idiot.
 
@SecondRikudo I enforce that entity should be able to do isEqual. So to be .. well.. comparable.
 
Same here. Document that the callable you're asking should do operation X, and be done with it.
 
yeas, that's because I have this interface
 
6:53 AM
@AlmaDo You know what's "Comparable", PHP doesn't, and neither does your long lost cousing from Pakistan who doesn't know a word in English.
The best you can do is to name it as best as possible, document, and hope for the best.
 
So I enforce the entity to be bound by this contract. This is impossible if I'll use comparison callbacks
@SecondRikudo it seems you've misunderstood me. I know what is interface and why to have it.
 
@Jack mention you are in ng
 
@AlmaDo What @LeviMorrison is suggesting is not to use an interface, but instead ask for callables to do the comparison for you.
 
I've been told "destroy it". Trying to figure out why
@SecondRikudo I got his idea. But with that I can not enforce anything since inside callback that may be anything
and also - still can not realize what's the benefit
 
@AlmaDo That's the same with your interface.
Even if using an interface, you cannot enforce someone to implement it the way you think.
 
6:56 AM
@SecondRikudo not same. With callback I can not be sure that it has something to do with comparable stuff. With interface - at least, I declared that it should act like this - and if someone breaks that - so he's an idiot, not me
 
Nothing is stopping them from public function isEqual($a, $b) { return $a != $b; //lol }
 
^ yes, but that makes author of that sh*t an idiot
 
@SecondRikudo so interfaces are useless?
 
@andho Interfaces are made for the programmers, not for the program. That's all I'm saying.
If the programmer chooses to ignore it, so be it.
 
it's interesting idea about callback, I admit. But still - can not (yet) see why it is better
 
6:58 AM
He'll have to dance around the constraint, but he can trivially not implement it.
 
@SecondRikudo your example is of a programmer ignoring it. He is breaking contract. His problem
 
^ well, he's not breaking the contract
 
@AlmaDo Something else you may do, is to use Composition
 
he's just acting stupidly
(I mean about person who wrote public function isEqual($a, $b) { return $a != $b; //lol })
 

« first day (1304 days earlier)      last day (3644 days later) »