« first day (1767 days earlier)      last day (3197 days later) » 

user895378
1:01 PM
morning
 
user895378
@FlorianMargaine I haven't seen it and now I'm really worried about clicking that reddit link /cc @Jimbo
 
@nikita2206 yep, plan is to branch off PHP-7.0 after PHP-5.4 is eold
so people don't have to merge up more than before
 
@rdlowrey You're famous! \o/ Now get ready to become filthy rich of you oss project like everbody else!
your*
 
@rdlowrey it's fine, auryn is used correctly :)
 
user895378
1:09 PM
@PeeHaa When you said "filthy rich" did you mean "desperately poor because I spend all my time responding to spurious issue reports?"
 
I meant rich of that nice fuzzy feeling your time now belongs to the community
 
Anyone here understands why StackExchange is such a fractured platform? For example, you have php questions here that are awfully answered: gamedev.stackexchange.com/questions/tagged/php
 
What else could one possibly want ‽
 
good morning‽
 
@Tyrael thanks
 
1:14 PM
@rdlowrey hehehe
 
user895378
I really wish finally wasn't a thing ...
 
@rdlowrey me too. It's a nice place to have spurious bugs…
 
Thoughts on method return type declaration of a class (VO)?
 
user895378
@Fabor not sure what you're asking.
 
user895378
return types are always useful ... don't need a reason.
 
1:20 PM
NM I could be being silly return types can be a class, for some reason I had it in mind only int, bool etc would be allowed.
 
If I use of SUM() for counting the all votes number, will it add all 1 values and subtract all -1 values ? or add all values together ?
 
What about trying it out?
 
select sum(value) from posts p left join votes v on p.id = v.post_id
 
This is not your command line
 
@PeeHaa this is my query ...
 
1:28 PM
So?
We are not a mysql client
 
aha ok !
 
55
:)
sum(value)
lol
 
@BlunT why ?
value is the name of column
sum(v.value) as numb *
 
Anonymous
1:44 PM
@Sajad So, did you get Ubuntu working?
 
Anonymous
I think i'm being a complete tard and not using functions correctly... But why is my array undefined when out of it's function? pastebin.com/23HVJt5s
 
Anonymous
unbelivable
 
@DaveRandom Hey! Am I able to read the queries stored in MySQL query cache?
 
Anonymous
@Ocramius ping?
 
1:56 PM
@samaYo pong
 
@garoevans That would be useful, and you're talking about MySQL, so I'm guessing no
:-P
 
user895378
@Jay php.net/manual/en/language.variables.scope.php your variable only exists inside the scope of the function where it's defined. That's why.
 
moment, let me remind myself of what I figure out last time I looked at something simiilar
 
@DaveRandom Ha, I thought as much. Someone in the office telling me I can and I don't believe them!
 
I don't believe them either ...
 
1:59 PM
i think differences in scoping rules between php and javascript confuse a lot of newbies
 
Anonymous
@Ocramius I am getting this symfony error related to doctrin's Annotation reader
 
Anonymous
AnnotationException: You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.
 
Anonymous
opcache is enabled, and all the relevant configs are checked.
 
Anonymous
if (extension_loaded('Zend Optimizer+') && (ini_get('zend_optimizerplus.load_comments') === "0" || ini_get('opcache.load_comments') === "0")) {
            throw AnnotationException::optimizerPlusLoadComments();
        }
 
Anonymous
This is creating the issue, I don't know why
 
2:01 PM
@samaYo php -i | grep opcache
 
posted on August 18, 2015 by kbironneau

/* by MonsieurLeMarquis */

 
is opcache a runtime configurable directive?
 
no
 
there are a few ...
 
Anonymous
@rdlowrey @DaveRandom Thank you, so declaring the arrayas global should sort it
 
Anonymous
2:02 PM
I don't get it, everything seems to be working fine
 
user895378
@Jay no, don't declare it global
 
can we see the output of php -i | grep opcache @samaYo
 
user895378
@Jay that's the last thing you want
 
@rdlowrey You may be interested: reddit.com/r/PHP/comments/3hencn/…
Sorry if it's already been posted – just got online.
 
Wait wut
opcache.enable is settable?
wow
 
Anonymous
2:03 PM
@rdlowrey oh.. Hold on let me read this again.
 
> The setting opcache.enable can not be enabled at runtime through ini_set(), it can only be disabled.
1 message moved to bin
@samaYo runtime is the keyword here
 
I was reading that @PeeHaa
you need to read the message and config properly @samy
 
@PeeHaa That would be of some use maybe when you want to run a very large script, that is only going to be run once, and don't want the slight overhead of opcache doing it's optimisations?
 
you are missing a setting
 
Anonymous
@JoeWatkins opcache.save_comments => 1 => 1 and opcache.enable => On => On those are the settings you are looking for right?
 
2:05 PM
you can't enable it from code because of memory mapping
AnnotationException: You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.
 
@JoeWatkins Oh shit. Sorry cc @samaYo :P
I was trigger happy
 
@samaYo I downloaded, but still did not install it yet ...
 
user895378
@Jay If you want to get the array out of the function then you should return it and do this instead: $myArray = function doSomethingAndReturnTheArray();
 
Again sorry :P
 
user895378
2:07 PM
:25155875 yes, that's a much better solution than making something global
 
Anonymous
I haven't installed any extension called Zend Optimizer+ that may be why ..
 
@Danack Too bad you cannot re-enable it again
 
thats the name of opcache
/s/the/a/ take your pick ...
 
Anonymous
@rdlowrey Ok but, i'm outputting elements of this array in a for loop later on in the code so.... I just add an iteration that ++ every time the function is called?
 
@PeeHaa I would suspect you can. All the stuff that needs to be done at PHP startup time will have been done....
 
2:09 PM
3 mins ago, by Joe Watkins
you can't enable it from code because of memory mapping
No idea what that actually means though :)
 
user895378
@Jay if all you're doing is outputting elements you probably don't need a for loop. Just use foreach instead
 
You can't enable it if it wasn't enabled at startup. If it was, did it's boot stuff it needs, and then you disabled it at runtime - it might be.
 
Anonymous
@rdlowrey But if I had to use a for loop, would the iteration++ in the function be the correct way of doing it?
 
@PeeHaa e.g. the checking is done via:
if (ZCG(enabled) && accel_startup_ok && (ZCG(counted) || ZCSG(accelerator_enabled))) {
 
user895378
@Jay I'm not really sure what you're asking.
 
2:11 PM
and accel_startup_ok isn't going to get changed by touching the runtime setting.
 
Hmmmm I think I see a new slowdown loop
 
Anonymous
@Ocramius This is the line causing the error, just incase you know what the problem is postimg.org/image/5rt2ol8zp cc @JoeWatkins
 
user895378
@Jay In PHP arrays are passed by value and not by reference. When you pass an array in or out of a function it is going to be internally copied as soon as you modify it.
 
user895378
So you won't be operating on the same array each time
 
@samaYo I already told you what the problem was, so did the error before me ...
 
user895378
2:12 PM
@Jay You could declare the array argument as a reference like this in your function signature &$myArray to indicate to php that you want it to be treated differently, though that is generally poor programming style.
 
@Danack yeah actually, it never unmaps, not sure why limitation is there in that case ...
 
a colleague of mine perfectly described one of companies legacy PHP projects: sorrowfully readable code
 
Anonymous
@JoeWatkins I told you, it's both enabled from opcache.ini and code.
 
you're not very good at listening ...
never buy glasses from a supermarket ... my lens just popped out ...
 
16 mins ago, by samaYo
AnnotationException: You have to enable opcache.load_comments=1 or zend_optimizerplus.load_comments=1.
11 mins ago, by samaYo
@JoeWatkins opcache.save_comments => 1 => 1 and opcache.enable => On => On those are the settings you are looking for right?
@samaYo read these 2 messages very carefully
 
2:17 PM
:-)
 
Stop using annotations and you should be fine is the real answer here :)
 
yup :-D
 
Anonymous
@FlorianMargaine Sorry, but I still don't get it. I have forgotten to mention that opcache.load_comments=1 is set ..
 
Anonymous
/ totally lost
 
@samayo load_comments vs save_comments
 
2:18 PM
@JoeWatkins if there was a check for accel_startup_ok then temporarily disabling it might work...tbh I'm not sure I care, or care about anyone who wants to be able to disable it temporarily...
 
agree, very strange
 
@ircmaxell do you know of any libraries that can be used to check for XSS vulnerabilities? i.e. will provide a set of dodgy strings, and then allows you to check how you've escaped them is valid?
 
Anonymous
@Orangepill Nah, that wasn't it .. Maybe there is another damn .ini config file somewhere. I can only find one at /etc/php.d/opcache.ini
 
(or anyone else...)
 
@samaYo php --ini
 
2:22 PM
@samayo check out phpinfo results and see where it's loading the config from
 
Anonymous
@Orangepill The ini it being loaded from /etc/php.ini all the extension related configs are in /etc/php.d/*.ini
 
@Danack check owasp, they have a few packages that do similar things. And a few pages that list different types of xss vulnerabilities
 
@samayo confirmed from phpinfo as called from the webserver?
 
k - I'll look again. There didn't seem to be a library available, there was stuff that would scan your HTML, but not allow you to integrate as a unit test.
 
Anonymous
@rdlowrey I get it... Took a while to get my head round it aha. Thanks for explaining, appreciate it.
 
Anonymous
2:25 PM
@Orangepill yes.
 
ow wow - owasp.org/index.php/Phpsec has even worse documentation than my own projects.
 
Anonymous
Ok, I give up with Symfony .. Going to Laravel
 
@samaYo sorry, busy now
 
Anonymous
I hate it, when something so popular just does not work out-of-the-box without wasting hours trying to fix something.
 
Anonymous
@Ocramius It's ok :)
 
2:30 PM
maybe it's not the tool then...
 
@FlorianMargaine sup.
This is my new acc.
 
3v4l.org switched to httpS today, if you have any issues report them to me
 
Didn't @Gordon explicitly say not to do that @HassanAlthaf ?
 
@Danack Gordon later said that since I created this, sticking with this is fine.
 
@Sjon it's all broken
nah, j/k
 
2:34 PM
@FlorianMargaine lol, made me look tho
 
Anonymous
rm -rf dev.symfony
 
Anonymous
\0/
 
Can anyone think of a reason why floatval() would round a float value up to 2 decimal places on one server but not another? Any likely php.ini or server settings ?
 
@PeterFeatherstone what is '2 decimal places'?
 
2:39 PM
@PeterFeatherstone what value are you giving it?
and what's the outputs?
 
I am giving 1439907007.9523 and it is giving me 1439907007.95
the other server it gives me 1439907007.9523 which is what I want
 
both run the same code?
 
exactly the same @flo
 
@Sjon \o/
 
@PeterFeatherstone did you try doing php -r 'echo floatval("1439907007.9523");' on both machines and confirmed they give you different outputs?
 
running now @nikita2206
 
@PeeHaa security ftw
 
@PeterFeatherstone as joe said:
$value = 1439907007.9523;
echo "$value\n";
ini_set('precision', 12);
echo "$value\n";
output is:
1439907007.9523
1439907007.95
 
@Danack so it's 14 by default?
 
Hi @Danack - Just checking now...
 
2:44 PM
@FlorianMargaine ¯\_(ツ)_/¯
 
$ php -r 'echo ini_get("precision");'
14

Seems to be (untouched 5.4 install)
 
@Sjon \o/
 
it is
 
Ok so @Danack it sort of worked but it added extra numbers on the end
Is there a way to use precision up to a specific number
The floats will vary in length
 
M ornings
 
Anonymous
2:47 PM
@RonniSkansing o/
 
I set precision to 25 as a test and got "1439907007.952300071716309"
 
@PeterFeatherstone It probably didn't add extra digits, and you probably want to use php.net/manual/en/function.number-format.php
@PeterFeatherstone which implies that "1439907007.9523" isn't representable as a floating point number.
 
I was considering number_format but if the decimal point amounts change then we will have an issue
 
the number doesn't change
 
2:48 PM
@garoevans (sorry got distracted by work) psce.com/blog/2012/04/03/… <-- that's what I have bookmarked from when I was looking at MySQL query cache stuff
 
stackoverflow.com/questions/32073550/… questions like that scare me
 
@DaveRandom n/p, thanks!
 
@PeterFeatherstone you aren't calculating money are you?
 
So many misunderstandings in just 8 lines of code :|
 
TL;DR you can if you really try, but only if you know the queries that might be in the cache and only by going all round the houses
 
2:49 PM
Hi @nikita2206 thankfully not - it is basically a legacy system we have been provided which as IDs for jobs that include decimal points, an example is the one I gave
before we are able to refactor this it is throwing an issue because it is rounding up to 2 decimal places and then not being able to find the record
 
@DaveRandom Not sure I like the profiling idea.
 
I don't like any of those ideas
 
Working around the problem by assuming what's being run via accesslogs!
 
@garoevans possible X/Y: what's the actual problem you are trying to solve?
 
the cache is stupid, is probably the reason it doesn't want to show you it's contents ...
 
2:51 PM
If I set precision to a higher number it adds numbers to the decimal points so cant find the record again - I can use number_format() to round to 4 decimal points but I cant be sure that there are no jobs with 3 decimal points at this time for example
 
why on earth are you using floating point numbers as identifiers in the first place ?
 
So I need it to round the string off to as many decimals as provided, not add any decimals or take away any...
@JoeWatkins - please read above - legacy system, will refactor in future etc. etc.
 
I read it ... I'm interested in the reason all the same ...
it seems as if you will have to start refactoring there ...
 
Unfortunately I am not aware of their thought process it was given to us today
 
@PeterFeatherstone wat. You're not seriously comparing floats exactly are you?
 
2:52 PM
from a completely seperate company
 
@DaveRandom I'm trying to work around the problem that we don't have query logs (user logs) for a legacy UI that I'm trying to move people away from.
 
@Danack I wish I didnt have to but at the moment this is the situation
 
Basically, I want to infer it's usage with the minimal effort. And 0 code changes.
 
so back to the problem... is it or isnt it possible?
 
Damn this room is getting more and more peepz.
 
2:54 PM
find out if they are consistent first ...
it's a couple of queries away surely ...
 
@PeterFeatherstone maybe you need to number format them to 4 digits after dot and then cut out all the zeroes if any. Seems like this is the only way you could get less than 4 digits in this "id"
 
@PeterFeatherstone I'm going to go with 'no'. If you're going to be creating floats and then doing an exact comparison, you have to create the floats in exactly the same way as the system has already been creating them. You won't be able to guess the format otherwise....
 
@JoeWatkins As I understand it, the reason it's not simple is because the cached queries are stored in a HT and the original query string is not stored, the hash is derived from the normalised form of the query structure after lexing rather than the input string (this at least makes sense as it means it's not affected by superfluous whitespace/parens etc). The "memory usage" argument that's usually put forward here is pretty weak though.
 
Good morning
 
@garoevans ...and you can't just turn query logging on for a bit?
 
2:55 PM
Hi @nikita2206 and @Danack - thanks for the help, youve got me half the way with the precision ini option which is great I wasnt aware of that so tahnks for that, I will be able to work the rest out from there
have a good day
 
two queries the same can take up two entries, they probably just don't want to shove that in your face ...
 
@JoeWatkins That's... not really a cache then, is it??
 
I said it was stupid ...
 
I didn't disbelieve you
And I am not surprised, either
 
:-/
@JoeWatkins that's not true
 
2:58 PM
@DaveRandom I could, but if I can find out what's already happened makes it even easier. Trying to look at July. The access logs are actually descriptive enough (luckily)
 
@ircmaxell it is ...
> Queries must be exactly the same (byte for byte) to be seen as identical.
SELECT * FROM tbl_name
Select * from tbl_name
two entries
 
@JoeWatkins where do you see that?
 
@JoeWatkins That's no fun!
 
in the mysql manual
 
where?
 
that's how it was in 2006
 
what's up?
 
Sup Ronni.
Long time no see.
 
Not much HassanAlthaf, just home from work. How about you, getting some coding done lately?
 
3:02 PM
Off topic. My hired boots for the climb arrived. Nay bad actually.
 
@RonniSkansing Finished the tournaments site recently for my client.
 
great
 
Got to do my site, it been blank since onths.
*months.
And had been learning Swift lately lol
 
@ircmaxell hasn't changed I don't think ...
 
@Fabor what kind of extreme boots are those?
 
3:04 PM
@Fabor Damn dude, it is amazing. ;P
 
@RonniSkansing B3 mountaineering. Basically they're like ski boots in terms of rigidity.
Good for kicking someone in the shin.
 
Query cache works similar to hashed-storage. Key passed - result returned. And it was everytime like - it does not care about query syntax ,treating query itself as a string - as a source for some internal hash generation. Though what @JoeWatkins says is true and neither query syntax nor upper/lowercase is involved here..
we are not surprised that md5('SELECT * FROM foo') != md5('SELECT * from foo') after all..
but to be honest, I didn't check that with percona..
 
@Fabor they look cool =]
 
Hey Ronni.
 
Ugh, from one RDBMS that's horrible to administer to another... does anyone know how to set up replication in a sane way in MSSQL?
 
3:10 PM
Does that make ssense to you?
Oh shit I forgot this is the PHP room
 
@ircmaxell 5.7 docs for same page have the same text, although I also was under the impression that is not true (I was working with 5.6 when I was looking into it). Possible the docs have not been updated.
 
Hey guys, how do you get the object back after updating private properties via Reflection?
 
@DaveRandom take sides off server, using appropriate screwdriver, lay on it's side, take one feline plied with one litre of water, hold feline above server until pee comes out, request new server with good software ... requires physical access to server, and a cat ...
 
@Danack let's say we pretend not to see it
 
taps nose knowingly
 
3:16 PM
@Gordon Not to see what?
 
your screwup (:
 
My screwup?
Wut
 
@HassanAlthaf that you are circumventing your qban with a new account instead of trying to improve the questions and get the qban lifted.
 
@Gordon I am not trying to get the ban lifted, I don't need to get it lifted to ask questions..
 
3:19 PM
@JoeWatkins About a year ago (at previous job) the shop unit below my office got a broken window and while the glass was being replaced there was a large hole in the side of the building for several hours, apparently a pigeon flew in, got into the comms room (they think via the false ceiling somehow) and shat on one of the servers. Cost them about £6K by all accounts.
 
@RonniSkansing So true.
 
Is this the standard approach with Reflection?
    private function hydrate($r, $data){
        $person = new Person();
        $r->getProperty('id')->setAccessible(true)->setValue($person, $data['id']);
        $r->getProperty('name')->setAccessible(true)->setValue($person, $data['name']);

        return $person;
    }
 
sigh
 
user895378
@DaveRandom No clue. I just hope you aren't using it to run a nuclear reactor ....
 
@HassanAlthaf yes, I know you are not trying. You just created a new account. One that is not qbanned. Technically that's exactly what we call circumventing a qban. But I'm gonna ignore it. Small fish.
 
3:20 PM
@RonniSkansing fyi if you add #.jpg to a an image URL that does end with \.(gif|jpg|png) then it will onebox it
 
@DaveRandom thanks, I was wondering
 
@prograhammer yes, but it's also doable with bound closures. Ideally it shouldn't be done though
 
@rdlowrey No no, don't worry. My reactors are all backed with sqlite.
 
@Gordon Well, if they got a problem with me creating a new account, I don't mind a question ban on this.. :L
 
@Gordon Is that how do mods think about us? Small and big fish? ;)
 
3:21 PM
@HassanAlthaf you sure you mean that? because some wishes can come true faster than you think ;)
 
@nikita2206 Because of performance reasons?
 
@prograhammer because you're breaking the contract by interacting with private/protected fields
 
@nikita2206 Or design reasons? Should I instead just call a single "update" method on the entity (a public update method). I might as well let anyone hydrate it right?
 
@PeeHaa no. the users we think about as fishes are only those who do something fishy ;) the others are valuable contributors.
 
@Gordon Yes, I mean it. You do know my purpose of creating this account. I was banned on StackOverflow from asking questions. I don't mind being banned on this too.
 
3:23 PM
@Gordon :-)
 
@nikita2206 The purpose is to do this "under the table". I mean, the contract exists for new developers. The only "breaking the contract" that can happen is in the repository.
 
ugggggh useless tag is useless
 
@nikita2206 I don't want to use Doctrine2 ORM. So I'm hydrating myself. That's way better than public setters.
 
@HassanAlthaf I'd rather have you as a valuable contributor of quality Q&A, so no :)
 
You wet yourself?
 
3:27 PM
@PeeHaa I'd wed myself if I wasn't already wed to the wife
 
^ LOL. Hydrating myself = wet myself?
 
@Gordon What do you mean? :P
 
@Gordon If only it was allowed to do that I totally would
I just love myself
 
@PeeHaa let's not go further into that discussion. I sense disgusting details coming.
 
Anonymous
^
 
3:29 PM
^ and love others, as yourself
 
Your spidey sense doesn't fail you my spidey friend
 
Anonymous
> The wise never marry; if they do .. they become otherwise
 
@HassanAlthaf what I said. I want you to ask good questions so I am fine with your new account being able to do so.
@samaYo witty. I like.
 
@Gordon Oh okay, I don't ask questions much, but when I do, no one answers.. just as this one: stackoverflow.com/questions/32047874/…
 
> WEDDING, n.
A ceremony at which two persons undertake to become one, one undertakes to become nothing, and nothing undertakes to become supportable.
 
3:31 PM
What.
In which dictionary is that in?
 
@prograhammer Had a long talk with @ocramius about a week ago and he endorsed reflection for hydration in custom mappers to keep the domain objects clean of setters.
 
huh, then instead of git merge one must do git wed
and besides, it's shorter
 
No, because,
 
@Orangepill okay good. I totally agree.
 
@HassanAlthaf in The Devil's Dictionary
 
3:33 PM
wed includes people.
@Gordon Lmao, that dictionary is hilarious.
 
@Orangepill Does your name imply you are indecisive? Red pill or blue pill?
or you are moderate
 
@prograhammer or best of both worlds
 
Anonymous
@Gordon don't forget the alimony
 
@samaYo the DD has no definition for that
 
3:36 PM
@prograhammer name predates the matrix as well as this orange pill
 
Anonymous
 
Anonymous
damn symfony, I re-installed it, and this time I chose yml instead of annotations, and still getting opcache/annotations error.
 
Anonymous
@Orangepill lol
 
@DaveRandom yeah, not really sure
 
3:52 PM
Does anyone know a quick way to turn an object's properties (including private) into an array? If I cast the object as array, what would the keys be?
or a reference link
 
@prograhammer (array) $object
 
@prograhammer You could also just try it out :)
 
537
A: Convert PHP object to associative array

GordonJust typecast it $array = (array) $yourObject; From http://www.php.net/manual/en/language.types.array.php If an object is converted to an array, the result is an array whose elements are the object's properties. The keys are the member variable names, with a few notable exceptions: intege...

private and protected will be prefixed with funny characters but they are there
 
they are mangled property names, do the cast in the proper scope and you'll get expected output
 
@Gordon if I get at those private/protected keys is that something that could change in a future PHP version and I'm in the hole?
 
3:54 PM
@Gordon hmm, the response seems wrong tho
 
Anonymous
@prograhammer For trivial questions like that use github.com/Seldaek/php-console
 
those single quotes specifically
 
@samaYo I did some research before asking. But seemed like a hacky thing.
 
you can also just write a toArray(): array
 
oh no you won't ...
 
3:56 PM
@prograhammer it's an implementation detail afaik so I wouldn't rely on it. but it has not changed ever afaik.
 
silly firefox, moving my tabs around.
 
@Ocramius the regular var_dump output would not show the chr(0)'s so I changed the output so people understand what they get
 
hmmm....wondering if I should make a helper that iterates over the array and updates the keys (removing that junk)
 
@Gordon ah, try with var_export()
the output is fun :D
@Gordon it's tested and frozen, tbh
Or well, I added tests because I started relying in for performance issues
 
3:58 PM
@JoeWatkins that's probably faster/better than casting and iterating over the array to update the key names?
 
@Ocramius what do I know about internals
 
better, dunno about faster ... wouldn't like to guess ...
 

« first day (1767 days earlier)      last day (3197 days later) »