« first day (1251 days earlier)      last day (3704 days later) » 

12:46 AM
@HamZa That is... awful
 
I know :)
 
 
2 hours later…
3:15 AM
Guys, does strlen perform string (not a literal, but stored in the variable) length calculation every time or takes it out of ZVAL?
I see that it's implemented as
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &s1, &s1_len) == FAILURE) {
return;
}
but cannot understand how exactly zend_parse_parameters processes it
Found it
 
 
2 hours later…
5:04 AM
Yay! VMs FTW.
Someone +1'd me on this; re-read it, and realized I never got a satisfactory answer (at least I didn't think it was satisfactory at the time)
3
Q: Clarification of PHP manual; default values passed by reference

Dan LuggDue to inconsistencies in the PHP manual (as I've posted about before) I'm just inquiring about some clarification. The Function Arguments page (http://ca2.php.net/manual/en/functions.arguments.php) has the following note: Note: As of PHP 5, default values may be passed by reference. Now, ...

^^ Perhaps I should add it to the question, but it I was curious about passing something as a default that could in fact hold a reference.
I don't think that's possible, as, for instance, you cannot use another property as a default to a method: public function foo(&$bar = $this->qux) { } so the default value pretty much borks the fact that it wanted a reference anyway.
That's fine, but is there anything that could hold a reference that could be passed by default; something that isn't a compile-time constant.
 
5:21 AM
hello anyone is from YII?
 
user652649
5:35 AM
@DanLugg weird
<?php
function foo1(&$bar = 10){ echo $bar; }
foo1($test);
echo $test;
 
user652649
just doing this, i'd expect to have $test set to 10
function foo(&$bar = 10){} foo($test); echo $test;
 
user652649
so not sure why this is allowed... since it isn't working at all apparently
 
user652649
<?php
function foo1(&$bar = 10){ var_dump($bar); } // var dump prints NULL
foo1($aaa);
 
@Wes I don't think that was the intent per se; but the fact that it's mentioned in the manual the way it is just suggests that there's something more to it.
In your example, $aaa is null when passed in; the function does not use the default value.
> Note: As of PHP 5, default values may be passed by reference.
^^ Either that simply means that previous to PHP 5 default values were forbidden for arguments that were byref, or I dunno.
 
user652649
found the reason i think... going to answer
 
5:46 AM
If it does just mean that, I think it should be reworded to:
> Prior to PHP 5, arguments accepted by reference could not be assigned a default value in the function declaration.
 
user652649
6:00 AM
@DanLugg answered, check it
 
user652649
wait, i made a disaster. lol btw the sense is valid, just need to fix the example xD
 
user652649
var_dump uses output buffer so it messes up the result a bit 1 sec
 
user652649
done
 
user652649
6:19 AM
idk, makes sense?
 
user652649
that would work only for actually skipped parameters, because of course using function foo(&$aaa = 10, $bbb){} foo(null, 10); it won't work (only variables can be passed as reference etc)
 
user652649
(improved the answer again)
 
6:40 AM
hello is there symfony2?
 
user652649
there is no symfony, only zuul
2
 
@TurdalievNursultan You bet: right here symfony.com
 
This code is working fine on localhost but becoming infinite loop on hosted servers..how to fix it? pastebin.com/pk7Jkp6G
 
@Wes I'm not going to lie, your answer is confusing as fuck.
That and it appears @Jack beat you by about a minute.
 
@TheLuckyGoof start by partitioning it into functions to make it more readable. describe your code in plain english. extract one function for each "and" or "then" you say.
 
6:46 AM
hello
0
Q: AJAX (internal server error 500)

Muneem HabibI am sending an AJAX request to php file. The data size send in AJAX is 26mb. i am getting 500 internal server error. My AJAX request code is as follows: $.ajax( { type: 'POST', url: "../app/uams/php/funcs.php", data: { ...

please help
i am sending almost 29mb of data through AJAX
but i am getting internal server error.
its working fine for small data
i have search on net and found that there is no data limit for ajax
please help
 
user652649
is it? xD i have improved it a bit... anyway no probs
 
check the http response and your servers error log to find out what the error is. — Gordon ♦ 29 secs ago
 
@Wes lol, sorry man. Jack was much more clear.
 
@Gordon I'm reading the items chosen from the session variable, finding out all the stores who has those products, sorting them and showing the sum of the products offered at each store
 
user652649
no problem, as you can see, i don't care of rep xD
 
6:50 AM
@TheLuckyGoof then break it into functions for every comma ;P
 
@Gordon i am getting status code as internal server error and contemnt lenght is 29 mb
 
2 mins ago, by Gordon
check the http response and your servers error log to find out what the error is. — Gordon ♦ 29 secs ago
 
@TheLuckyGoof Is that code not indented properly? It just got messed up when you copy/pasted, right?
 
@Gordon its working as expected on my localhost but going to an infinite loop when hosted on server, where i should fix
 
@TheLuckyGoof are you sure its an infinte loop and not just taking very long because you pull in too much data?
@TheLuckyGoof also, once you partitioned it into functions it will be easier to find out where exactly it runs into the loop
 
6:53 AM
@DanLugg sorry for bad paste, here is the indented one pastebin.com/XUaELbWG
 
@TheLuckyGoof That's all good; I was just more concerned as to whether or not you were actually working on something as messy as the first post. If you're not, then nevermind :-)
 
@Gordon its hardly some 10-15 records
 
Mornings, today I am especially tired
 
Morning
Let me re-ask question. Because this will make me crazy pretty soon:
15 hours ago, by Leri
Is there any fast way to force https://.* sources to be fetched as http://.* ?
Context:
15 hours ago, by Leri
@bwoebi No. Larger context is: I want to update ADT in eclipse however office firewall blocks request to https, while does not for http
Proxy is configured properly, i.e. uses the same settings as browsers and other network related apps. I've already checked one.
 
@Gordon my data kenght is 29 mb
i have also set max upload file size to 100 mb
 
7:02 AM
That reminds me, I have a question from earlier that went unanswered (or unnoticed)

Something stinks like cheese and inheritance

15 hours ago, 17 seconds total – 2 messages, 1 user, 0 stars

Bookmarked 24 secs ago by Dan Lugg

 
@MuneemHabib yes, you said so multiple times. and each time I told you need to check the error log. do so now. your error log will say why you get the 500.
 
@Gordon But Gordon! It's 29 mb!
 
@DanLugg 29 is not 42
@Leri you could setup a global network proxy
 
@Gordon could u please tell me how to chek it plzzz
 
@Gordon Google's update service will ignore any request unless it's made by eclipse and I am unsure what headers it sets to identify itself. Hmm, I might be able to get that information though.
 
7:06 AM
@MuneemHabib 1) Open the error log 2) Read the error log 3) Understand the error log 4) Close the error log
Part 4 is optional.
 
@Gordon & @DanLugg I fixed it. no clue how, I tried to find out the bug by breakpoints/exit and in the end without any edit it fixed itself. This happens with me every few weeks :P
 
@DanLugg If RequestInterface is a MessageInterface looks sane to me.
 
@Leri Yea, should've been named RequestMessageInterface for clarity; it is an extension of the interface.
 
@MuneemHabib do you have a system administrator? Ask him/her. Otherwise, see my comment below your question.
 
@Leri My only "problem", is that Request references the MessageInterface contract twice, through two channels of inheritance/implementation
 
7:08 AM
@DanLugg BTW, I'd name MessageInterface just Message... Same goes about Request.
 
@DanLugg where is this error log?
just tell me location i will read it
 
@Leri the proxy should transparently forward the entire request
 
@Leri Yea, I already subscribe to the Interface suffix convention; I don't find it particularly problematic.
 
@Gordon Fair enough.
 
Although I agree that in some circumstances it's unnecessary, it's all or nothing as far as I'm concerned.
Man, I am loving this VM workflow. All I have to do is whack my box so that I can reinstall the host OS but stripped down.
 
7:14 AM
@DanLugg How about this?
However it's over engineering for small apps. ^
 
Hmm, perhaps; MessageBase isn't a Message though.
See, if I were to go that route, I'd use a trait.
 
@DanLugg Oh, sorry, just typo. It should implement Message interface.
 
Oh okay.
Actually... maybe I should use a trait.
 
I had Java in mind after looking that diagram.. I am not a big fan of traits..
They look like to global scope for me...
 
@Leri Really? I think they're useful in some circumstances.
 
7:19 AM
I may be noob, but I really hadn't use-case for traits in my projects
 
I like traits for one thing ... logging :)
 
I'm actually using traits as a code-generation component too.
 
It's the copy/paste Swiss army knife hehe
 
@Jack I recently found it useful for adding helper functions into my phpunit testcases
 
<-- this guy is just noob (:
 
7:20 AM
@DanLugg Yes.. Well, when I see traits I see something like: class SaneClass extends SaneBaseClass, Global {}
 
Code generator produces a class and a trait; it always rewrites the class, but it only creates the trait once. The class uses the trait, so you can add stuff to the class and continue regenerating it without losing changes.
@Leri Yea, that's nonsense.
I use them (along with a few related strategies) like partial classes from C#; at least in the aforementioned case.
Because partial classes are also, basically compiler-assisted copy/paste.
 
@DanLugg They are two completely different things, are not they? Even if you make traits look as partial class it would not be it. :)
 
@Leri No, they're not the same thing. However the manner with which I use them is familiar to that of using partials in C#.
The code generation case being the main one.
I dunno how much .NET you've done, but Entity Framework (ORM) code generation produces partial classes, so that you can continue to regenerate them as your underlying schema changes, but you won't lose manual changes, which you make in other partial class files.
So, I'm doing something similar, except that instead of creating your own partial classes which'll get compiled together with the generated ones, you just edit the trait, which won't be overwritten by the generator.
Anyway, time for bed (about 3 hours ago)
Night folks.
 
@DanLugg I use custom ORM, because I do lots of concurrent stuff so Context based orm is heavy for me. The structure even for C# is: DTO (that is auto generated) and DomainObjects holding schema for interacting with DTOs. I do pretty the same with php.
The only difference is that in PHP array serves as DTO.
@DanLugg Night.
 
@Leri lol, AOP (array oriented programming)
Night :-)
 
7:30 AM
@Gordon Hmm yes ... I'll keep that in mind :D
 
131
Q: Trolling the troll

Erel Segal HaleviA troll has captured you and is forcing you to write malware (defined as a program that damages the computer that runs it). The troll can read and understand code, but is not so good at spotting bugs. Your goal is to write a program that: Looks like malware; i.e., a beginning programmer readin...

 
hello
i wnat help
 
morning
 
file_get_contents()
i want to set path in file_get_contents()
 
7:47 AM
@User1988 do you also want a pony?
 
> PHP Version 5.2.17
I hate you hosting providers. ^
 
@Leri bleeding edge
 
I don't understand why developers don't understand that shared hosts suck and they are not really cheaper than, at least, VPS. :/
 
I'm tired but I can't sleep.
If you're a NetBeans user, I just filed: netbeans.org/bugzilla/show_bug.cgi?id=243073
 
@Gordon It's definitely bleeding :)
 
8:04 AM
hi every one
I am new to php.
Has anyone here worked with google APIs?
I facing a problem with google sign in button.Where I referred the tutorial from https://developers.google.com/+/web/signin/add-button and getting these error while signing in
"Error: origin_mismatch"
10
A: Error: invalid_client no registered origin

Johno ScottIn the new Google API Console, configure your OAuth2.0 authorized origins from Your Project > APIs & auth > Credentials You might need to add a new Client ID specifically for a web application (I did because the default was for AppEngine) Create Client ID > Web Application > Authorized Javas...

0
A: Google Analytics API - no Registered origin

InfinityIn the new Google API Console, configure your OAuth2.0 authorized origins from Your Project > APIs & auth > Credentials You might need to add a new Client ID specifically for a web application (I did because the default was for AppEngine) Create Client ID > Web Application > Authorized Javas...

 
good morning
 
i referred these questions
 
Whenever I turn APC on I get this exception: http://i.imgur.com/Xm0v02U.png
When it's off everything runs fine. I am totally lost, does someone have the slightest idea how I could fix that?
hmmm, does APC remove the comment annotations?
 
8:24 AM
how does comparison of DateTime() works? i.e. this works well:
$one = new DateTime();
sleep(1);
$two = new DateTime();
var_dump($one<$two, $one==$two, $one>$two);//true, false, false
but this isn't:
$one = new DateTime();

echo $one;//fatal
i.e. it definitely not about comparing strings
couldn't found good link for 'why it's working' and why DateTime is "comparable" for <, > and ==
 
maybe looking at DateTime::Diff will help
 
8:41 AM
no. the thing is - that I want to understand how is it possible to compare some objects which even do not implement __toString() and compare them not just on equality, but for < and > too
well, __toString() is out of the issue (because there will be not string conversion on comparison) - just noticing
 
Marning
 
mormngitro
 
or else: this is valid too:
class C
{
   protected $holder;
   public function __construct($h = null)
   {
      $this->holder=isset($h)?(int)$h:0;
   }
}

$one = new C(1);
$two = new C(3);
//also valid: false, false, true
var_dump($one>$two, $one==$two, $one<$two);
how PHP knows that $holder contains value to compare?
and, more important: what is necessary condition for class for such comparison to work?
 
@AlmaDo It's a bit like how arrays are compared.
 
no
 
8:53 AM
[1] < [3] => true
 
The "custom" comparison is defined in the underlying code, classes can have a "compare objects" handler registered. lxr.php.net/xref/PHP_5_5/ext/date/php_date.c#2017
 
@Jack what if there are more that 1 element? or different length?
 
For "normal" classes that don't have that, the behaviour is defined in the manual.
 
@AlmaDo What's your point?
 
My tests shown that it will take first property for comparison
 
8:54 AM
Show your tests
 
@salathe good, but what is about any object comparisons?
 
So you're saying that if the first property is the same, it will always compare the same no matter how many other properties there are?
 
@Jack yes, 1 sec
 
sure, i have 5 mins before i have to go :)
 
so not exactly like arrays
 
8:59 AM
@AlmaDo Hmm, not sure what's going on there; but this seems to suggest I'm right: codepad.org/MxVzq62T
 
Hmm, you guys are doing something really weird.
 
@Leri We're doing PHP, of course it's really weird!
Time up, gotta go!
 
Later.
BTW, we really need something like Comparable interface. So that <, > and == can be applied to objects...
So when one of the operands is instance of Comparable Comparable::compare($otherOperand) method should be called. That method should return integer and its sign decides if operand is more, less or equal to operand.
What do you guys think about that? ^
 
It's intuitive. But real problem begins when comparing objects of different classes
as they are non-comparable
 
9:08 AM
Oh joy. We are going to move to a new datacentre this weekend :(
 
@PeeHaa We are?
 
Yes. Our servers
This is going to be a pain...
 
@PeeHaa No-one told me!!
 
:P
 
@salathe Why was that withdrawn?
 
9:10 AM
Not we as in "we", but as in our office sadly ;)
 
@Leri I don't recall, there'll be internals thread(s) about it somewhere.
@PeeHaa Ahh, phew! Had me worried there for a moment. :P
 
:D
 
user2286243
Is using <?= ?> bad practice?
 
@VarunAgw not if it is in templates
^ assuming that you separated templates/"views" from the rest of your application
 
user2286243
ok thanks
 
9:19 AM
oh, I forgot...
 
ThW
Good Morning
 
@salathe Well, as always, the reason is: php devs will do weird things
 
btw.. this object comparison is a way to access private properties..
 
Mornings
 
hi, @DaveRandom
 
9:28 AM
@AlmaDo Can you elaborate on that? I assume you mean access private properties out of scope.
 
I've posted my current thoughts here - if someone has good ideas - that would be welcome
@Leri yes. All you need is to be able to create object of same class and then compare it to tested object. Via binary search you'll easily find your value (:
 
not yet
I'll take a look
hm.. same principle, but only complex thing is: to remember which picture is for which number. So what's the big difference?
 
@AlmaDo If you are talking about this it isn't accessing private field out of scope.
 
@Leri no. 1 sec
well, not "write" to property, but get it's value
 
9:37 AM
@AlmaDo By default, objects are compared according to their symbol table ... not sure why you still had to ask the question :)
 
@Jack because didn't receive certain answer here :p well, good thoughts were said - but may be community knows better
 
@AlmaDo I gave you an answer half an hour ago .. the fact that you disagreed doesn't make it less true ;-)
 
@AlmaDo You really think SO-at-large know more about PHP than Room 11?!
 
@Jack no. you didn't get the point. This is some case. But this doesn't mean - it will always be so. That - I want to know
@salathe am I naive? :D
 
@AlmaDo But it is always so ... the problem lies in the fact that you're not supposed to rely on the behaviour .. that is, until Comparable interfaces are added to the language.
 
9:42 AM
@Jack yes!! this is the point. Is it always so? (that's why I've asked). If yes - then where can I read that it's always so?
 
You can read it in the source, obviously.
 
@AlmaDo It's generally accepted and I would have thought logically obvious that you should never rely on a behaviour that is not documented because the author of the code is free to change an undocumented feature at any time.
 
And the only reason it's not in the manual is ... because you're not supposed to know.
 
@DaveRandom good point
 
It's funny to see how you think always is something different than always :)
 
9:47 AM
@Jack Shouting always changes the semantic meaning of things
 
That's what my wife says too hehe
 
RETURN TRUE; // this is truer
 
Well.. f*ck you firewall(s)... And super/mega/giga blocking of stuff...
 
Feb 7 at 13:36, by Jack
TRUE, for when true is not true enough.
 
Anyone worked with World Pay?
 
9:51 AM
They're too ex$
 
@Leri I mean this :p
so you're able to detect value of property without being able to access it
 
Why not just parse the var_dump()? =D
 
:D
 
Wait, doesn't get_object_properties() work or sth?
 
@Jack it's get_object_vars() - and no, it will fail
 
9:55 AM
bah
 
that's because property is private
 
Oh, right ... (array)$object :D
 
odd. That worked.
I thought it won't work
 
That's actually documented lol
Well, the private properties will have some \0 in their name, just to throw you off.
Protected too iirc
 
Morning!
 
10:01 AM
haha, got the link that I was looking for - but in comment :p
hi, @Duikboot
 
Is there a way in linux to see all the connected people ( mac adress etc ) who are on the same ethernet network?
 
arp -a
oh wait
that's just arp cache. not actual connections
 
Can I find in a way 'human ' names like the computer names used?
 
devart.withgoogle.com tag @JoeWatkins
 
netstat then, I think - combined with arp
 
10:03 AM
nbtstat <-- for Samba compatible hosts
 
^ not in linux (: it's win :p
 
I believe Windows has nbtstat too.
 
it has (natively)
 
just ping the broadcast and then check the arp cache again? :)
 
10:05 AM
Do I have with netstap -arp
 
@Jack you're evil man :D
@Duikboot no. check established connections (with IP addresses) via netstat and then match them with arp cache
 
Ok I ran the netstat command.
 
run man command firstly :p
 
Then I did: arp -a
? (ip....) at 3c:d9:2b:61:9a:eb on en2 [ethernet]
are the results ( 6 results )
Is there now a way to track an ip? ( except pinging )
 
arp should show you Ip-address
but that's cache, not real-time connections
 
10:10 AM
Yeah that cache command works
but then I still don't know wich computer it is
and every computer has a name here.
allright I found a computername like: npi1108ec.ra-blablaba.local
 
Win-name? Then as it was said - nbtstat
 
Can I digg deeper in that one?
 
what is 'deeper'? You already have name (:
 
I don't know how far you can digg into this :)
 
(::)
 
10:13 AM
There is no option to track for example the network use for that computer?
 
network use for some independent host? Fortunately, that's impossible in common case :p
 
For someone in my network
 
you should do that on you network's gateway
 
I can ping to it and retrieve results without package loss but I was thinking by myself it there is a way to get more information from a user.
yolo007ec.ra-rastatel.local (192.168.0.01) at 2c:c1:2e:21:6:ec on en1 ifscope [ethernet]
With that for example.
 
hi guys :)
 
10:21 AM
morning
 
Hello, @fusillicode
Yo Hamza!
 
hi buddy @Duikboot :)
 
@Duikboot 'sup ? It's hot today =P
 
guys let me bother you all with my "today's problem" XD
today's problem: the node names of the xmls produced by the Nikic parser contains colons (i.e. ":") and this seems to break Nokogiri css funcionality
 
Yeah today is a good day. youtube.com/watch?v=wIIQRUoGEhY
 
10:25 AM
does anyone know if there is some particular reason why the names have the columns?
it's really annoying, I can't use Nokogiri css selection functionality due this!
 
@fusillicode Could you provide a link with the code or something ? I've no idea about which parser you're talking about.
 
sure, here's the parser :) github.com/nikic/PHP-Parser
 
Today it's official -turn off the phone day ( for me )
 
and here's pastebin.com/w5QMbTiQ an extract of one XML :)
btw that's the library (gem) I'm trying to use to parse the XML nokogiri.org
 
blame ruby :)
 
10:32 AM
c'mon don't be so hateful @HamZa :P
actually I'm trying out Ruby because there are some interesting ORM gems that work with Redis
in PHP there's nothing like this :(
 
@fusillicode Could you give me the code you're using to generate that XML ? Also, what if you tried a simple replace to replace all : to \: ?
 
actually the code I'm using is the standard serializer of the over mentioned parse and right now it's difficult for me to extrapolate the code :(
anyway I tried to replace the :
and you know what...maybe the : aren't the problem XD
btw thank you very much for you help buddy :)
 
welcome, also it seems the php parser needs those colons
@fusillicode I told ya, ruby !
 
u're right buddy...ruby! XD
 
ThW
The colons are the separator for a namespace prefix, looks like the php parser uses several namespaces
It is possible to use xml namespaces with CSS selectors (the | is used in this case), but most css selector libraries do not support it.
 
10:47 AM
 
0
Q: How does throw internally work?

BabyAzertyI would like to know how throw works in PHP. For example, does it act like a die() or exit() ? How can I know what is done internally ? I am asking this because I saw Kohana using their $this->redirect() method with a throw to terminate the script execution instead of the traditional exit.

Hopefully someone here can answer it :)
 
@BenjaminGruenbaum WOW who voted to close this to move it to SU ?
 
@BenjaminGruenbaum Too broad, methinks
 
Not sure, I upvoted it, interesting question. I don't think it's too broad.
 
> I am asking this because I saw Kohana using their $this->redirect() method with a throw to terminate the script execution instead of the traditional exit.
 
10:51 AM
I know exactly like I'd answer a similar question with JavaScript. You just need someone who knows the engine to run into it.
 
ye gods, really???
 
That's like doing undefined_function(); to terminate execution
trigger_error('I would like to finish executing now', E_USER_ERROR);
 
Morning
 
11:07 AM
Holy shit, it really does use exceptions for redirects: github.com/kohana/core/blob/…
 
Jay
hey guys
Could someone help me with a SQL query?
SELECT SUM(IF(MONTH(added_date)=1 AND YEAR(added_date)=1,1,0) as one FROM users . What I am trying to do graph database based on how many users registered each month.
 
I am wasting time on working around firewall restrictions rather than developing... I have never felt such discomfort at office. :(
 
^ port-forwarding will save the world (:
 
@AlmaDo Meh, traffic goes to centralized firewall where I don't have access. When boss is around it's not a problem he grants me permission but now it became PITA.
 
11:22 AM
@Leri so set up some proxy at home and let it forward traffic via port-mapping as a sample (you'll send traffic on allowed ports from office to home)
 
@AlmaDo you'll send traffic on allowed ports from office to home.. :D I hope, he'll arrive soon, so I can contact him.
 
yeah. that'll solve the problem - until your home host will be added to black-list :Ь
 
In fact there's just white list. :D
 
oh. //me hides
just rootkit gateway then. Your problem is only in this word "just"
 
11:37 AM
Hello everyone, i want to know that how i can run php commands on windows..
Actuallt using Laravel
actually
I want to run this command:
php artisan migrate --package=cartalyst/sentry
 
9
A: How to access PHP with the Command Line on Windows?

DaveRandomYou need to add your PHP installation directory to the %PATH% environment variable, or work from the PHP installation directory. To add it to path (The best approach - Edited for Windows 7): Right-click on a My Computer icon Click Properties Click Advanced system settings from the left nav Cli...

 
:) Thanks
Yeah i did that
now what to do next
@ham
@HamZa
 
Anyone here use htop in Linux
 
ping @Jimbo
 
? I've never used htop :-)
 
11:52 AM
No, unrelated to that :-P
Just wondering if you still need that private repo and if you still need it to be private
 
@AlmaDo Found better work around. I use 3G network and tether via usb.. However, I should not be charged for office work. E_PEDANT
 
@ircmaxell you got quoted by that guy that is ranting php, you brought shame to the tribe :P
 

« first day (1251 days earlier)      last day (3704 days later) »