« first day (1915 days earlier)      last day (3261 days later) » 

14:03
@Danack are you using them?
@zaq178miami I'm just about to.
in part because they have a $50/60 day free trial - vultr.com/freetrial
Any reference for class __construct with $_POST variables ?
@TiagoMatos what is your question?
14:18
I have an Jquery .load function that posts into an php file. I'm adding a class to that file to handle the page rendering. Should i build this class in another file or can i handle the Post request inside the class __construct ?
No it won't work because the class is not initialized
so the __construct method will never be called
so i have to initialize the class inside the file for the post to be handled
right?
@TiagoMatos I am not sure what you are asking but in general your constructor should not do work beyond simple assignments. it's purpose is to put the instance into a valid state. nothing more.
@Gordon yes i realized that when i was writing. I got a work arround :) Thank you
wat x2
14:31
@NikiC @Andrea Can we please fix convert_op1_op2_long to actually use convert_to_long instead of _zval_get_long_func? zval_get_long boils down to strtol(), which isn't really matching PHP's number handling... [also in other places too maybe…?]
Should you be pushing all of your constructor arguments into the factory that creates it?
I avoid factories whenever possible … less callbacks and indirection makes code easier to read generally.
What about all the raving of "Don't go around using new"
The point is that you shouldn't use new in your called function (except it's a local object), but no problem of using it at the point where you inject it.
Who's saying not to use new?
14:34
Ah.
The more abstract people say code should become, the bigger my headache gets.
You should abstract, but you shouldn't abstract for the sole purpose of having it abstracted.
With a nice design most necessary abstraction will come by itself. The architecture will guide you then.
That first one seems to go off the rails. The second one makes a more compelling argument.
14:38
yes
i have problem with hiding php extension through htaceess on lamp
but it worked fine on wamp, after i moved to lamp i am getting 404
well .. do you have mod_rewrite installed and enabled?
yes enabled
@Gordon Always take that with a big grain of salt… This describes quite an extreme case, but usually you don't need such a factory.
@bwoebi I don't mind using new if the depedency is from within the same package and I sometimes use create methods on the objects for easy stubbing
15:01
Where should reusable methods go in the controller layer? This system maps urls directly to one of many "controller" class/objects.
Say if I have a method which modifies a bunch of models which could be reused across the site, surely it doesn't belong in a specific "controller" class
posted on January 13, 2016 by nlecointre

/* by Bob Anderson */

Wes
Wes
@PeeHaa remember the site i wanted to make, php do's and don't's?
Wes
Wes
i found a new media :B
twitter.com/ThePHPBible … whose account is that?
Wes
Wes
15:09
rofl
Obviously his
Wes
Wes
yeah i just followed some room 11 folks
ah lol
I use references
The PHP God sounds more like the PHP Charlatan
Whoever the PHP God is, he/she/it follows me
Wes
Wes
15:10
there's a reserved place in hell for you then
traits, refs and goto have their usages. And now shut up, stupid PHP god.
Wes
Wes
rofl
i agree on traits though, also goto :P
If you're condemning references for all purposes it's probable you don't understand them
Or you're just sick of seeing other people who don't understand them abusing them
Wes
Wes
lol
anybody please help me - how to hide file extension through htaccess in lamp
it's working on wamp not on lamp
Wes
Wes
15:13
or maybe it's you that don't know that cause countless bugs and that php would work just as fine without using references
There are some things you cannot do without them
@muthu why are you developing on a wamp when you're gonna deploy them on a lamp? use vagrant.
Wes
Wes
@QuolonelQuestions tell me one. lol
Passing arrays by reference
Wes
Wes
yeah totally a good idea lol
15:15
Sometimes it is
I wrote a recursive array walker
Do you think I want it copying each leg of the tree?
No; I want it to walk the very same array structure
From start to finish
I often wondered, though, is it considered a bug that $x = &$foo['bar']; actually creates the key 'bar' in $foo if it's not set?
no it isn't.
I'm not assigning anything to $foo in that statement, though
So I wouldn't expect it to be written to
Even if it's intended behaviour, it's still unexpected behaviour
@gordan not like that! before i used wamp. but when i moved to lamp one of my old project i need to rework on it. so now i am having problem.
You only can reference something existing
hence it is created
a reference is a write access.
Hence it also writes.
15:20
@QuolonelQuestions you're a really tough customer wrt that array_udiff() question. But I can see how it was still kind of confusing, because it really is kind of complicated, especially if you're not used to seeing highly optimized algorithms like that.
I wouldn't know if it's highly optimized
The problem I have is being able to understand what the fuck I'm doing if I want to implement a callback that works with it
Lets suppose I want to write a callback that compares two complex objects
How exactly am I supposed to deal with that?
Normally I would just compare each pair of fields and see if they are the same
But since they have to be sorted in order for this "highly optimized algorithm" to even work correctly, I now have to take into account this X factor
Which is something I don't even understand
but, it needs to be sorted with respect to whatever criteria you're using to determine if two objects are the same or not
you don't actually need to implement a full equality test
If I have an object with 10 properties and all of them are required to determine if the object is unique, I should test all 10 of them
15:23
then in that case, yes
Which would be fine if I was writing an equality test to begin with; but I'm not, I now need to worry about sorting the objects against each other with respect to 10 different properties
And I don't even have the first clue how to go about doing it
Let's suppose it was much more simple
I have an object with just two properties, an int and a string
I want to compare the string first and then the int
As I understand, the way this is normally done for the purposes of sorting is you pass the strings to strcmp() and the ints you can just subtract from each other
pseudocode: foreach property $k { $comp = ($a->$k <=> $b->$k); if($comp) return $comp; }
But how do I combine both of these operations together?
Well that's one approach, certainly, and the one I took thus far
md5(json_encode(get_object_vars($his))) === md5(json_encode(get_object_vars($another))) // objects have identical state
15:26
So you're suggesting that I return early whenever one of them is not equal
that is, pick an order, and for each property, compare them. If you get < or >, then you're done. If you get ==, you have to look at the next property.
Yes, because at that point, and assuming you use the same order every time, the rest doesn't matter
The other idea is to examine them all regardless of the result and then somehow try to sum them together and, I guess, make some kind of sense out of that result
But lets suppose that's a terrible idea
it'd be like comparing 999999999 <=> 987654321. You see the first digits are 9, so you look at the next one. You see that 9 > 8, so you know that 999999999 > 987654321. You don't need to look at the rest of the digits.
Going back to the original idea of returning early during property inspection, it now makes me think that the order in which I inspect the properties is somehow significant
Wes
Wes
it's much better doing like teresko suggested. use immutable objects, generate an hash string and cache it, then compare just the hashcode
15:28
Like, do I get a different result depending upon the order in which I examine them in?
(then replace digits with properties in an object)
Of course, I do not want that to happen, but since I don't understand how the algorithm works I might think that it does
Yes, you could. That's why you have to look at them in the same order.
@jbafford Don't get me wrong, I'm not suggesting you change the order during program execution. I will write my code to examine them in one given order and that order will be fixed. But then lets suppose, in a parallel universe, I wrote them to be examined in a different order. Am I getting different results in those two universes? ;)
you could
15:30
Well that's fucked up!
I would not have this problem if it accepted a predicate instead of a sort function
And since it accepts a sort function I don't know how to write it!
Hence the question
And hence why I'm not totally satisfied with the answer ;)
That might be a good (and separate) SO question.
heh
Well I'm down for more karma if you are :P
Or whatever they call them points on this website
... why do I have a feeling that this individual is one of "spirit science" subscribers?
@tereško I'm not sure how that comment follows.
Wes
Wes
15:35
@QuolonelQuestions why do you want to use php's bundled functions? you should have realized by now that many things in php are fallacious and the community is trying to move away from them by creating better custom libraries. for instance Levi created Ardent (oop data structures) which is a pretty good one
Why should he have realized that by now?
I'd certainly never heard of Ardent before just now.
Wez just likes making sweeping generalizations about PHP. He even made a Twitter account for that sole purpose
Although, in general, I would like to agree and just avoid using it, but I can't because the base class which comes from a third party library is using it
var_dump($someVariable) … more than 10000 lines of output.
So now I am on this quest to get to the bottom of what is actually going on
Wes
Wes
@QuolonelQuestions irl you would now have a concave nose
15:39
Steady on, keyboard warrior
Wes
Wes
as there's lot of empty room in your head
@Wes just add him to the tiny-avatar people
How does the curvature of my nose alleviate that problem?
Guys, come on, we're all just trying to learn something here.
Wes
Wes
@tereško you've changed.
FITE HIM
15:40
Jan 10 at 12:24, by Quolonel Questions
If smell energy is eternal, why can't we use it to build a perpetual motion engine?
4
what's the point in fighting stupid?
4
I wish I was as smart as you
wtf, why do I keep hearing about "smell energy" in here ?
It's the future. Soon people's body odor will power their wearables.
Hi guys. so I have a table which have variables that I defined on an external file and included it in the file where it is called. When I execute it on a web server, it works fine but when I transfer it to a localhost, I got an error saying the variables are undefined
@Pretorian code?
15:46
@bwoebi did you check response to that internals thread ... apparently we are allowed to engineer unfair votes, so long as we document that it's unfair in the RFC ...
ok wait
can i post here?
@Pretorian if it's more than a snippet best to use one of these listed services.
@JoeWatkins well, yeah… AFAIK, Pierre changed his vote from no to 1+1 because of this. I suspect the other two 1+1 voters just weren't aware of that.
@Pretorian code should go in a pastebin (see the chat guidelines link in the sidebar)
ok thanks
15:48
I tried to ping @Leigh in time ...
I dunno who the other voter was
I had to vote for yes even though I wanted to vote no ...
I dunno why this was even brought up for discussion ...
if we can change the support schedule for PHP after the vote for releasing PHP 7, and not releasing 5.7, we can surely make this adjustment after the fact ...
I hope some other people speak up ... again ...
I do think that rfc has one tiny flaw in the voting choices
Even if someone voted no for whether to extend the support timeline, that second question still should be answered as a, "if it gets extended, this is what it should be".
@JoeWatkins the unfair is subjective in this case imo. not sure we can objectively argue that the result would have went the other way if the counting method was different and exlained to be different beforehand
aw deer
@Pretorian so what's the actual question? What's the variable that's undefined?
15:53
that is assuming that many/most of the voters did not read or understand that part of the rfc
@Pretorian are you calling session_start()?
or they assumed votes would be counted fairly ...
@Pretorian are you aware the as of php 7.0 the mysql_* function are no longer available?
no doesn't mean yes, whatever
15:54
soryy I'm not aware of that
@Pretorian have you checked your HTTP headers to make sure the cookie is being set and your browser is actually accepting it?
if the $_SESSION vars are coming up undefined it means there is no current session with those vars.
nope ok I'll check that one sorry
@Tyrael at least there were minimum two people switching their vote after being notified about that flaw in the RFC. I don't know whether the other two were notified or not…
@JoeWatkins that means that they either did not read that part of the rfc or did not understand it
and this is why I can't say that the options were objectively 'unfair'
I may be confused. Which rfc are we talking about here?
15:56
@Tyrael the votes were unfair in the way that there was no possibility to say "if it has to be extended, then 1+1, but I prefer no extension at all"
maybe they didn't seem it at the start, but once it was a clear majority for "yes", which is when I came to vote, it actually did feel unfair ...
what bob said ...
personally I was advocating for having an 5.7 exactly because I was sure that 7.0 will be delayed (we never managed to exactly meet any roadmap or come ahead of it) and that the that the original 5.6 eol timeline is too short to mark the eol for 5.x
I am developing a quiz app and i am accessing questions from json files. These files are linked in the database with unique quiz id. My question is how to store the answers submitted by the user.
@bwoebi what? convert_to_long and get_long_func do the same thing
but if the majority wants to prolong the 5.6 lifetime I can't do much about it, and it seems they want
user924016
15:58
mornings
@NikiC no … the one is strtol, the other is_numeric_ex
Wes
Wes
@Ocramius i grasped by your recent questions about variadics that you use callable's as factories rather than named classes with a create() method in it. is that correct? how's the life with that? :B
@Tyrael I had to vote yes, because there was no sensible option ...
it seemed to be the least damaging, didn't work ...
Wes
Wes
i'm really looking forward to use marcio and nikita's patch about callable signatures... that's hella good :P it's probably going to be my fav php 7 feature
@bwoebi it also did not provide an option to keep the current deadline for the normal support and extend the extended support, or to extend the support for 2 years
15:59
@Tyrael actually I consider 7.0 as a 5.7 and it should have been 5.7 too. It didn't have had that big of an userland impact.
there are a bunch of possible options you couldn't pick
@bwoebi no it doesn't
convert_to_long and get_long_func are fully symmetric
are you confusing this with convert_to_number?
@Tyrael no there weren't, if you voted no, you didn't get to vote on the second part
Wes
Wes
(i am assuming that is going to pass. why would it not?)
so if you think that you prefer no over any suggested options you should have voted no

« first day (1915 days earlier)      last day (3261 days later) »