« first day (504 days earlier)      last day (4440 days later) » 
00:00 - 18:0018:00 - 00:00

6:12 PM
Hi @tereško & @rdlowrey
Hi @LeviMorrison :)
 
@hakre 'ullo
 
Hi @LeviMorrison @hakre
 
posted on March 03, 2012 by Ilia Alshanetsky

At Confoo I had an interesting conversation with Guilherme Blanco regarding the fact that in Doctrine 2 they had a performance issue due to usage of array_key_exists() and how it was significantly slower than isset(). His anecdotal example was that doing isset() took 0.5 seconds, while array_key_exists() for the same operation took 5 minutes! That seemed wrong, given that array_key_exi

 
@Feeds Probably xdebug again ^^
 
@rdlowrey usually the code written with CI is so subpar that it doesnt need any more obfuscation
 
user895378
6:39 PM
@Gordon Haha agreed.
 
user895378
@hakre Hello hakre
 
user895378
I'm hungover in sweatpants with leftover mexican food and there's a biblical rain storm rolling through my part of the world. Yep, my Saturday's got "programming hermit" written all over it.
 
@rdlowrey: The company I work for uses Phalanger for deployment to customers who refuse to use linux because they fail.
 
user895378
@Leigh The customer is always right! Or is it the customer is always stupid? I can never keep that one straight.
 
The second one for sure
 
6:47 PM
@rdlowrey: The customer pays your wages
 
user895378
@Leigh When I said customers were stupid what I meant was I love customers :)
 
The topic brought up by feeds is interesting. If anything I would have thought array_key_exists would be faster than isset...
since the former only has to check that the hash exists for the array, and the latter has to do an additional check once the key is found?
 
user895378
I would think so too ...
 
@Leigh @rdlowrey Function call overhead.
 
@NikiC: isset isn't a function? :)
Is it one of those language binding whatsits? (like print?)
 
6:53 PM
nope
it's a construct...
 
Makes sense with the xdebug stuff then, no stack/call analysis to do
 
yup
 
xdebug is the cause of most performance benchmark differences :)
 
not most. Most are because they never isolate functionality
 
I don't think I could live without xdebug
 
6:56 PM
Hi @NikiC
I can't live without xdebug in development.
 
yup, but not in prod
 
hi, this is the first time i'm asking a question in chat. I am passing two arrays (latitude and longitude coordinates) a href (url) by serializing it in one script and unserializing it in the destination script of the <a href tag. (This works fine by the way).
I am now trying to pass a third array which is an array of string values (it holds all the place names relating latitude and longitude array passed ), but I get the error: 'Notice: unserialize(): Error at offset 0 of 5 bytes' when I serialize this third array. And when I don't serialize it I get the following error: 'Fatal error: Cann
 
obviously, but where do most people who want to do quick and dirty benchmarks to it.. in dev
 
sure not in production.
 
I'm guilty of it too
and actually, I had never considered the performance penalty of doing it. I will be mindful of it in future.
@user1135192: Why are you doing it like that?
 
6:59 PM
php -r is your friend
 
@user1135192: 1) serialise is evil, 2) why doesnt' the second script have access to the values anyway? 3) serialise is evil
On a Phalanger related note, some of the old versions used to serialise data differently to official PHP, headaches were had by all during product upgrades
 
I have passed two arrays fine this way by serialising it (thats what I was told when i posted it as a question in stackoverflow) and now i want to do the same by passing a thrid array through the url which is an array of the place names, but it keeps displaying an error
 
@user1135192: Does your question have more details? Can you link it?
 
@user1135192 Hard to say without seeing the code in question. You might want to base64_encode the serialized data so it won't get mangled because of characterset conversion on the network roundtrip.
 
@Leigh i have tried to google it but no luck with things that i have tried. I can't link it because i can only access it at uni
 
7:07 PM
@user1135192: You can only access your SO account from uni... sounds strange. Anyway why aren't your lat, long, and place name all in one array?
 
@Leigh i only work on it from uni. I thought it would be better to keep them separate, then run it through a for loop which will extract the coordinates from both arrays. Should they be in one array? Is it better to? I thought it would make any difference
@hakre I am a beginner to php. What do you mean?
@Leigh *wouldn't
 
@user1135192: It's logical to keep related data together. And this is what hakre means about base64: codepad.viper-7.com/IVREj1
 
7:23 PM
ok thanks @Leigh and @hakre, I understand what you mean, I will give it a try when i go in next. I've got to go, but thanks for your help! :)
 
Kind of interesting, with the rep "fixes"... I misunderstood (a bad) question and gave a bad answer, which I deleted. The answer had upvotes and when I deleted it the rep was removed (fair enough), but the answer is still showing as +votes. I wonder if I undeleted it and a vote was removed, whether I would lose extra rep.
I miss the SO when questions were questions.
 
7:54 PM
Hi all
 
8:04 PM
hi guys is there any problem with this ?
SELECT ml_id FROM ml_table WHERE word IN (make,look)
 
8:25 PM
hi guys, 1 page > many pages in php = least server load ?
 
is there any resson why session virables can't be pushed into a if stament ?
 
how do you mean ?
like = if($_SESSION['cake'] == "brownie") {
 
well i set a session virable at the top of the page lets say username then i do a few whiles and try and insert the session virable into a mysql update but it updates it to 0 even tho i print it out at the top of the page
and when its printed out its fill with what i want
but has soon has i put it into a sql update its inserts 0
 
you have a problem with your mysql my fine sir :) but i don't know why, you'r syntax is normal right ?
$random_variable = $_SESSION
mysql = "insert into blabla()values('$random_variable')"
??
 
0
Q: Session virables getting blocked by if staments

user1121083I have a very big if stament I am making 2 session variable up on top of the page then i print them off and they are set. But for some reason i have a mysql update in side the if stament and the session variables are not getting though, I print off them at the top of the page and it prints of fi...

ive posted the question here with full code
i even put in a print r be for the sql update and after . Be for it goes into the update it set ok but then after it goes into the update its nothing...
been trying to get it to work and find out whats wrong on and off for 5 months now -_-
 
8:35 PM
i see, and you use the newest php version ?
 
yep
 
good, have you solved the 2 } ?
 
My server using kloxo which auto updates when a new version comes out. Of phpmyadmin and php
and nope
its got 2 } because there is 2 above it
there is a { next to the foreach and another { next to the while
 
okay, i can't help you, because i don't have time to read all this code, but i hope you solve you'r problem!
 
Thanks
Think ive fixed it now
 
8:41 PM
All I saw was pokemon and I decided I cannot bring myself to help you
 
its a lot of code ent it :)
ive been look at that code for 5 months trying to get it to work
i think its the update statement which is wrong
 
hey , guys , anyone know a good article along the lines of :
"php closures for javascript developers"
 
@tereško Why?
 
1) i already know how closures work in javascript ( and i am very good at it )
2) i dont want to dig through docs to fund out the differences in "spelling"
 
9:31 PM
The difference is JS implicitly binds scope, PHP explicitly binds it
that's about it...
 
9:46 PM
wampserver sucks
the description seemed to be too good to be true, and it turned out that it is not true ...
just doesn't work.
 
are you really so gullible ?
@NikiC , or are you unable to set up a server in VM ?
 
@tereško Not gullible, desperate
 
huh ? how so ?
 
Thought that wampserver would be a nice way to have multiple PHP versions around (as I need 5.2 right now) and it seemed like it supported that. But 5.3 just crashes for a particular script and 5.2 doesn't work at all (probably incompatible Apache and PHP builds)
Really, it can't be that hard to provide a solid PHP package for Windows... somehow both wamp and xampp have their problems :(
 
emm .. there ARE solid php packages
 
10:01 PM
@tereško By "package" I mean all inclusive, so you don't have to frickle everything together. Though I am slowly coming to the conclusion that it actually is faster to manually install and configure everything than to try and get one of those packages to work as you want.
 
you are like one guy we had at highschool dorms - a skilled developer , who did not know how to launch TurboPascal , in which he made the programms
 
:)
 
What you sighing bout again?
 
Nothing really, just expressing myself as I usually do
 
10:23 PM
it might be my fault
 
> Warning: sort() expects parameter 1 to be an array, cannot cast referenced parameter from object in
Ok, so now I'm happy with that patch
 
emm ... ok @ircmaxell so how can i do this in php "
 
do what?
 
var foo = (function(){
    var data = [ 1, 1, 2, 3, 5, 8 ];
    return function ( n ){
        console.log( data[n] );
    }
})();
foo(2);
 
10:39 PM
$foo = call_user_func(function() {
    $data = array(1, 1, 2, 3, 5, 8);
    return function($n) use ($data) {
        echo $data[$n];
    }
});
$foo(2); // 2
 
so i can return a function ... thats nice
 
sure
 
oh .. wait
is the $data writable ?
 
yup
just like JS
 
just making sure , because the is that use ( &$variable ) option too ..
 
10:44 PM
Oh wait, yes, you're right, you would need to reference, otherwise it's treated like a function parameter
I got confused with the closure binding
 
maybe i should just write that exercise in JS
i really don't like using references in php
 
This popped up in the moderation queue today.
15
Q: Reference - What does this symbol mean in JavaScript?

Thomas ShieldsWhat is this? This is a collection of questions that come up every now and then about syntax in JavaScript. This is also a Community Wiki, so everyone is invited to participate in maintaining this list. Why is this? Stack Overflow does not allow searching for particular characters. As a conseq...

 
hrm
# sapi/cli/php -r 'function f((int) &$i) {$i++;} $a = 2.5; f($a); var_dump($a);'

Warning: Argument 1 passed to f() must be of the type int, cannot cast referenced paramter, double given, called in Command line code on line 1 and defined in Command line code on line 1
float(3.5)
 
@ircmaxell That is rather strange sounding ^^
 
Well, how would you word it, keeping in mind I can only change "be of the type integer, cannot cast referenced parameter" without major editing
 
10:57 PM
@ircmaxell sure that you can't?
I.e. directly throwing an error not possible in the context?
 
                                        if (Z_ISREF_PP(arg)) {
                                                return zend_verify_arg_error(E_WARNING, zf, arg_num, "be of the type int, cannot cast referenced paramter", "", zend_zval_type_name(*arg), "" TSRMLS_CC);
                                        }
Well, I can, but I would like to avoid it if possible, since it either means creating a new zend_verify_arg_error function, or copy-pasting everywhere
 
"cannot cast referenced paramter"
There's a typo right there
 
@ircmaxell I don't see much of a problem with doing a zend_error(E_WARNING, "Cannot cast referenced parameter");
 
@BoltClock which one?
 
@ircmaxell "paramter"
 
11:00 PM
@NikiC Well, that would be tricky to track down, I'd want argument info there
good call @BoltClock, thanks
 
@ircmaxell Personally I'd just disallow that at compile time altogther
For me casting type hints don't make sense together with references
 
fair enough... I'll go change that
 
Even in case that the passed type matches
 
changing error level to E_CORE_ERROR
 
After downloading a file, does anyone know why this command wouldn't work?
system("tar -xzf /home/site/public_html/latest.tar.gz; mv wordpress /home/site/public_html/".$db.";");
 
11:06 PM
disallowed cast hints for referenced parameters (syntax error). And if it winds up in the error where a referenced parameter reaches a cast, raising an E_CORE_ERROR, as it's disallowed syntax and shouldn't ever happen without causing major issues...
 
@ircmaxell .. sometimes it feels like php developers are missing out
 
# sapi/cli/php -r 'function f((int) &$i) {$i++;} $a = 2.5; f($a); var_dump($a);'

Parse error: syntax error, unexpected '&', expecting variable (T_VARIABLE) in Command line code on line 1

# sapi/cli/php -r 'function f((int) $i) {$i++;} $a = 2.5; f($a); var_dump($a);'
float(2.5)
 
wouldn't the casted number be stored in a different location (in memory) ?
 
11:25 PM
@tereško well, if you use a reference, it's telling it explicitly not to store it in a different location, hence why it's disallowed
 
well , yes , i was just saying that this indicates a conflict and seems like a valid behavior
 
right, unless you wanted the original variable to be a reference, in which case you should have casted it first
 
then again , the error message leave room for improvement .. unfortunately, you cannot have an error message that slaps your fingers with a ruler
 
@tereško Which the "parse error"
 
yeah
 
11:29 PM
well, it's the standard one that's given. The & is unexpected, since you can't use referenced parameters with casts...
Ok, I guess I should start writing the RFC
@NikiC: are you going to write the "lossy cast" warning/notice message RFC? I've got 2 here to write
 
@ircmaxell Imho it would be better to just catch that and throw a proper error
So that it's clear why it's disallowed ;)
@ircmaxell If tyrael won't, then I'll do it.
 
@NikiC Well, if it's totally disavowed, why not make it a parser error? Makes more sense than an runtime error to me...
 
@ircmaxell I mean a parser error, but with a friendlier message ;)
 
@NikiC Ok, so at least someone else will. I have no problem doing it myself, but I'm already writing 2 patches and RFCs, so it'd be nice to give it to someone else...
@NikiC Well, it's caught by zend_language_parser.y, which is why
I could make it parse ok, and then cause the error in zend_compile.c...
 
@ircmaxell That's what I mean ;)
 
11:37 PM
Well, let me see what that takes...
 
or directly from the language parser. whereever it is more appropriate
 
hrm, let me pop open gdb and check out how it receives the arg...
 
hm?
 
Well, I need to do that at the opcode level, which means that I can't work with the parsed arg entry. And I'm not too familiar with the opcode entry for arguments (aside from the u.const.type_hint, so I need to see how to check if it's a reference
 
huh
ah, now I get what you mean
or do I?
I mean, isn't that specified in the pass_by_reference argument (the last one)?
 
11:45 PM
in the op struct?
 
huh?
I'm not sure we are talking about the same thing
 
probably not
 
I mean the last argument to zend_do_receive_arg
 
                                                        char *tmpname = emalloc(strlen(type_name) + 3);
                                                        sprintf(tmpname, "(%s)", type_name);
                                                        efree(type_name);
                                                        type_name = tmpname;
that feels wrong...
 
off for today
night
 
11:50 PM
good night
 
00:00 - 18:0018:00 - 00:00

« first day (504 days earlier)      last day (4440 days later) »