« first day (2168 days earlier)      last day (2771 days later) » 

9:02 AM
fun
I like how google gives me results to source files these days
 
it knows
 
OK @Saitama gist updated (added a client file as well for this one)
 
\o/ also thanks a lot! going through it!
 
@Gordon yay, not a fake one?
 
Guys, how would I require the iconv extension in my composer.json?
 
Anonymous
polyfill ?
 
9:27 AM
@Aborted "ext-iconv": "*"
 
@Dave
@DaveRandom Thanks!
 
Yeah thanks @DaveRandom!
 
@Danack I wasn't sure I have to add the ext- part, hence the question
 
Anonymous
You're the best @DaveRandom !
 
9:29 AM
@DaveRandom You rock!
 
Wes
thanks @DaveRandom
 
@DaveRandom you suck!
8
 
@DaveRandom Cheers
 
user6618037
Does anyone know why my PHP SELECT statement is missing the first row?
 
user6618037
$stmt_user_uploads = $auth_user->runQuery("SELECT * FROM user_uploads WHERE uploaded_by = :user_name");
$stmt_user_uploads->execute(array(":user_name"=>$_GET['username']));
$user_uploads = $stmt_user_uploads->fetch(PDO::FETCH_ASSOC);
 
9:43 AM
define "missing" it?
I'm guessing that underneath that you have a loop? don't call fetch() before the loop, only call it in the loop.
 
user6618037
if($user_uploads['uploaded_by'] == true) {
while($row = $stmt_user_uploads->fetch()) {
echo '<div class="style col-md-3">';
echo '<div class="hovereffect">';
echo '<img src="'. $row['file_name'] .'" alt="" class="img-responsive" />';
echo '</div>';
echo '</div>';
}
}
 
user6618037
That while loop doesn't echo out the row with an id of 1 but shows 2, 3, 4, 5 and 6.
 
runQuery is either a horrible name or you are using the api wrong
I would expect that to execute raw sql
 
remove that if() and remove the fetch() call above it
 
Is there a way I can check if an image is being loaded from the HTML itself, or directly from the URL bar?
 
9:46 AM
@Frondor no
 
:(
 
@user6618037 what are you expecting that if() to do?
 
What is the best way/book/link to start OOP concept?
 
subtext here about it being "possible" but both useless and annoying
@Frondor Why would you even want that?
 
user6618037
9:47 AM
@DaveRandom if the user has uploaded then it'll echo it out, if not then it will show a message in the else statement.
 
$user_uploads['uploaded_by']
 
@user6618037 you need to check this instead:
 
You have a user with username true?
 
@PeeHaa I want to load images like <img src="img.php=?id=xxx&w=128"> for example, but I want the user to get redirected somewhere else if he tries to access http://example.com/img.php=?id=xxx&w=128. I know it won't secure the image, but It will annoy the user indeed.. So he won't download 400+ item images.
 
!!docs pdostatement.rowcount
 
9:49 AM
[ PDOStatement::rowCount ] Returns the number of rows affected by the last SQL statement
 
(assuming mysql, doesn't work with most other drivers)
 
@Exception Best link is www.google.com
 
user6618037
@PeeHaa
$stmt_user_uploads = $auth_user->runQuery("SELECT * FROM user_uploads WHERE uploaded_by = :user_name");
$stmt_user_uploads->execute(array(":user_name"=>$_GET['username']));
$user_uploads = $stmt_user_uploads->fetch(PDO::FETCH_ASSOC);
 
@Frondor If they want to download they will. Resistance is futile
 
I'm dealing with stupid kids, not really technical people
 
9:50 AM
The only people you annoy are the innocent ones
period
 
No, because they will actually see the images in the html.. They have no reason to access the image directly
I've seen many wallpaper sites using that technique
 
I said period
 
Well.. grow up then.
 
You don't want to listen. Fine don't listen
 
9:51 AM
Right click -> save image as...
you can't prevent that
so why prevent direct access?
 
but but but right click disbaled!!!!1
 
<head explodes>
 
@DaveRandom Actually, you can't right click -> save image as, a svg image.
 
R.P
Hi, got quick question regarding PHPUnit and acceptance testing. I have test classes that have are methods for testing a single API request with different parameters. One of those methods test that if You insert too long value for DB column, then You'd get certain HTTP code back. Now the problem is when query is made, then entitymanager (Doctrine) gets exception and closes itself and methods (tests) after that also fail due to fact entitymanager is already closed.
 
9:54 AM
@Frondor of course you can
 
@Leigh classic
 
heh
 
You can't if the image is loaded inside another svg. Try it.
You'll have to check the source code and then open the <image > link directly
 
R.P
Any suggestions how to solve it without replacing DB with mocks, without having each method open their own entitymanager or make validation for each input and not have entitymanager even get to exception?
 
@R.P You can assert that that given exception occurs.
 
9:56 AM
@Frondor which is still trivial to do
 
@Frondor OK well I have no idea if that's true because I don't speak front-end and I don't really care about it, but I can tell you this: you cannot prevent people from downloading things if they are public resources. If the browser can display it, the user can download it. You can do things like checking the Referer header, people can get around that. Since no system can give you 100% protection (or even 50%), why bother putting the work into creating a leaky system in the first place?
 
@DaveRandom actually if the browser can display it, it will have downloaded it already and it will be in the cache
 
Also that ^
 
@R.P If your tests are dependent on the result of the execution of a previous test, that's wrong. So yeah, I would say that you either mock the DB or bring it up and tear it down for each test
 
9:57 AM
You can use flash to semi protect things
 
R.P
@Oldskool the problem isn't excatly with capturing the exception, but the fact that entitymanager that each method uses is closed - therefore You cannot make any insert/delete/update queries
 
but then you can also throw yourself out of high windows
doesn't mean you should
 
Who's talking about preventing users to download public assets? Please, don't put words I didn't spit in my mouth
 
Anonymous
^^ :)
 
@R.P that sounds like a badly isolated entitymanager. are you sharing the EM between tests?
 
9:58 AM
@Frondor If the browser can display them, they are public assets.
 
@R.P How would you be able to do that in production anyway? If the entity manager throws an exception, you should handle that in your live code as well.
 
R.P
well, the thing is that entitymanager isn't isolated at all. It is for the sake of not reinitiate connection for each test (tests would take too much time)
 
@DaveRandom And who's saying it isn't like that?
 
OK you are clearly here to fight and I'm not interested.
 
morngdgs
 
9:59 AM
...and it's gone!
 
@R.P But if you're testing if insert/update/delete is done, you're actually testing the entity manager, which is not the repsonsibility of your app. So your test scope is too broad, you should keep it isolated to the unit of code you wrote, not what Doctrine wrote.
 
Anonymous
@Ekin o/
 
I'm not the one fighting here, I'm not the kid saying "period" after every stupid message.
 
@Ekin morafguhadsufhasiud
 
R.P
@Gordon - as of right now, yes. I see making entitymanager separate for each test as valid possibility, but maybe there is something better.
@Oldskool - when exception occurs, then entitymanager is no longer needed as further update/insert/deletes are not gonna happen.
 
10:00 AM
hi all
i am working on webservices that use in iOS application
and get an issue that json encoding decoding
 
@R.P oh, I've been there. Global EM is a pain in the ass. So is isolating it :)
 
if some one pass string copy with google emji that wont json encode and get
The data couldn’t be read because it isn’t in the correct format.
Miley!!!!!!🤔
 
R.P
@Oldskool - I'm actually making acceptance testing, but using PHPUnit for that. This means I test the whole service as full.
 
this is the emoji
 
@DaveRandom so I was fiddling with those, and it I made two files sender.php | reciever.php ... and tried running it with $ php sender.php && php reciever.php which doesn't really do anything...
 
10:02 AM
@R.P You can perfectly do that, but then just mock out the entity manager and test some expectations instead like save() is called once or twice etc.
 
anybuddy help please
 
@Frondor the simplest thing you can do, is a referrer check, the consensus is correct though, if people want to download them en masse, they will.
 
@R.P we isolated the EM. Instantiating it is not the issue. The performance hit comes from resetting the db to a known state. we ended up doing this only when the test would change the db.
 
I tweaked the server.php a bit tho
 
I've just found a mod_rewrite solution that does exactly what I wanted
 
10:05 AM
@Saitama no you have to run them from two separate terminals. That's because of the way the terminal works... when you do && is waits for the first process to finish before running the second one.
 
@Frondor it'll be an anti-hotlinking solution that's easily bypassable with a tiny bit of code
 
ah I see
 
also @Saitama both of those files are the same :-P
 
oh lol I pasted the wrong link
sender.php - https://gist.github.com/SaitamaSama/d915cda24bd25d5c620d1f684949b1f0
reciever.php - https://gist.github.com/SaitamaSama/794cf4ac01d298a7ee18d83535fb1ce7
 
Of course, but as I said earlier, that's not a problem actually
 
10:07 AM
@DaveRandom what was the link for pingable people again?
 
@Frondor you will have to handle caching inside your img.php then though
 
ty
 
ChatClient has a method for it, btw
 
yeah, just need to find out how it is sorted
 
10:08 AM
still the same thing, I modified sender.php to the following:
<?php declare(strict_types = 1);
sleep(10);
$socket = stream_socket_client("tcp://127.0.0.1:47806");
fwrite($socket, 'HELLO');
echo "Written";
 
R.P
@Oldskool - why should I start to mock as entitymanager fails and thus closes? Better idea seems to be having separate EM for each test case. In that case I wouldn't have to bother with replacing DB with mocks.
 
@PeeHaa oic, I think it's by last posted message time but there are two timestamps in there and I'm not sure what they mean
 
and I ran $ php receiver.php from another terminal
 
@Saitama are you trying to have two different client processes that can send data to each other through the server?
 
kk
 
10:10 AM
and waited for sender to echo written, and when it did, nothing was yet printed to receiver
@DaveRandom exactly
 
Anonymous
@PeeHaa talked and seen maybe
 
yeah was thinking the same
 
@Saitama OK, give me a few minutes
 
oh, np at all! ;-)
 
@bwoebi isn't that exactly what your variant of the patch (the one using exceptions) does?
or do you mean only make this opt-in in special places?
instead of making it the default?
 
10:27 AM
@NikiC Did I propose that? Don't remember … but might well be :-D
I was fataling out for most ops except "safe" ones
I do not remember what the issues were
 
@phpalcohol @github Just had some free time, global config and adjustable per repository. There you go: https://gist.github.com/kelunik/01f33a01a6e330c6f6fcab9b75383c50
Just in case anybody else needs something like that. It's still a double-load, but I guess it's acceptable if you really always want these filters.
 
10:46 AM
hey guys
 
@Leigh WOW!! thanks
 
you're whalecum
 
...
 
If an API lets you specify a physical address and DX number, is it a case of one or the other?
or do you need to specify both? Or, is a DX number tied to a specific address / postal box already?
 
@Saitama what? what do you think why they are called sperm whales? /cc @Leigh
 
10:54 AM
> The name sperm whale is a clip of spermaceti whale. Spermaceti, originally mistakenly identified as the whales' semen, is the semi-liquid, waxy substance found within the whale's head (see below).
 
Personally I always thought it was originally shortened from "Spiderman whale"
Today holds nothing but disappointment.
 
:P
 
R.P
Regarding my acceptance testing problem. I found out that setUp runs before each test method (oops) where I can reinitialize entitymanager and also other needed variables. This helps to resolve my closed entitymanager problem and also having each test start from "clean slate" (aka one test not affecting other etc.) Thanks everyone.
 
@Leigh that was one of the stupid answer I have ever seen in stackoverflow.. :P
 
@Saitama WRONG!!! ever seen a sperm whale? did you see any balls? NO! why? because they are within the whale's head!
 
10:56 AM
@Exception you must be new here
 
so ... it looks like LibreBoot project's owner has imploded
 
Anonymous
very very new here...
 
@Gordon lmao
 
Anonymous
@Gordon I saw a sperm whales balls once.
 
> The FSF revealed itself to be hostile towards trans people, so libreboot voluntarily decided to leave the GNU project
 
10:57 AM
@Leigh you must guess that not decide..
 
W-wat
 
@JayIsTooCommon lies!
 
:V ^
 
there is a KiA post with materials here about that LibreBott thing
yeah, it's biased, but it has docs
 
Yeah the more I read about this the further away I want to get from it
 
11:04 AM
that's a normal reaction
but I am starting to think, that on needs to be prepared, because you can get hit by this shit any time
 
they didn't want to play with the fsf anymore so took their ball and went home.. so what?
 
not "they"
only the guy who has commit access did
anyway, it's just a minor shitstorm, mostly for entertainment value
 
okay, so he didn't want to play with the fsf anymore so took his ball and went home.. so what?
 
Dropping FSF and GNU is perfectly laudable
Basically doing the right thing for the wrong reasons ^^
 
Both sides are crazy imo
gnu is still scary as fuck
 
11:14 AM
@tereško just the man i wanted to see. Do you mind if i ask a hopefully quick question?
 
something small
I am at work ... and even trying to write some code
 
If a domain object needs to be validated against your database, but domain objects are not supposed to know about the data access layer, does that mean I have to encapsulate the validation strategy in an object? or should I go with the "never let the domain object enter an invalid state" approach
 
genital centred obsession belongs in the bronze age
 
@bassxzero "Don't ask to ask, just ask."
 
@JoeWatkins E_NOCONTEXT?
 
11:23 AM
25 mins ago, by Sean
> The FSF revealed itself to be hostile towards trans people, so libreboot voluntarily decided to leave the GNU project
 
@bassxzero what would the "validation against database" entail?
 
@Danack Normally I don't but I have asked @tereško a lot of questions lately and i'm sure he is annoyed
 
if the DAL encounters an error (like violation of UNIQUE constraint), it would throw an exception
 
"does that mean I have to encapsulate the validation strategy in an object?" - no encapsulate it in an interface, which can then have multiple implementations. One of which would be the 'real' one that validates against a DB.
 
what to do what exception is then up to you
 
11:25 AM
@Danack I maybe find it weird that people can have other gender identities or sexual orientation … But I still haven't understood any reason why people are ever hostile towards them…
 
@bwoebi you probably should read more context
the "hostility" was someone being fired .. and the moral outrage was triggered because the fired person was trans
bottom line: you cant fire trans people
ever
 
So, there has been established correlation between a firing and the person being trans even if there was none?
 
@bassxzero is it really "validation" is are you dealing with "data integrity check" of some type?
 
@tereško the validation is business logic. Such as this object is allowed to be created/saved at this time
 
@bwoebi as I said, read more of the context, not just one quote
@bassxzero why does it have to be done against databases? ... my XY problem sense is tingling
 
11:30 AM
@Saitama check you github notifiactions
 
got it!
checking it out atm!
 
@Saitama OK so the first thing that we need to do is move away from one huge script, so at the moment there's nothing "new" in there, I just re-implemented the same thing using a bit more of a sane OOP approach
So start by pulling that apart and looking at how I broke it up
 
@DaveRandom hmm... i see! yup, on it!
 
I'll work up an example of two clients communicating with each other in a few minutes, just need tea + smoke first
 
np... ;-)
I'm just ':O' atm by all those, thanks a lot! I owe you one!
 
11:34 AM
@tereško the bulk of the moral outrage was triggered because someone decided to leave the fsf, with the bottom line being you can't decide who you want to associate with unless kia agrees with your reasons
 
@Saitama btw you'll need to composer install, it doesn't use any external packages, just for the autoloader
 
@PaulCrovella hmm
 
@DaveRandom inorite ;-)
 
@tereško you might be right about the XY thing. I'll play around with it some more. Thank you again
 
11:42 AM
that's 'kawaii'
 
11:59 AM
@Saitama I just pushed a couple of bug fixes
 
yup, got it..
anyways afk for a while
 
12:14 PM
@NikiC Unfortunately you'll find that he chooses Laravel next
 
i'm looking into a possible issue when upgrading a older php stack -> I have seen some references that the __doRequest function of the SoapClient has a 'hidden' change. I read that the first parameter isn't an xml string anymore, but is now a
'random' string of characters. (sorry for the newline). e.g.: stackoverflow.com/questions/26214940/…
I cannot reproduce with a quick docker setup though. Does anyone know how to invesitgate further?
 
!!lxr soapclient
 
@PeeHaa There were no results for that search
 
Anonymous
Well that was very odd..
 
@PeeHaa There were no results for that search
@PeeHaa Nothing went wrong but I couldn't find a suitable definition. Ping DaveRandom if you think I should have done.
 
12:18 PM
@DaveRandom
:P
 
Anonymous
Sent my CV to a company and they asked me to come in for a chat.. within 5 minutes they offered me a job.. O.O
 
Yes but that's not lxr though ;-)
As in the actual source instead of possible outdated docs
@JayIsTooCommon Did you forgot to wear pants?
 
What a surprise it isn't that SoapClient is defined in a weird/non-standard way
 
hehehe
 
12:19 PM
there's also a second 'source', a comment here: http://stackoverflow.com/questions/3500527/php-soapclient-timeout

saying

"'ve tried this in PHP 5.4.6, but it seems, they have changed the signature of _doRequest() without further notice. $request does not contain the raw XML anymore,"
 
Anonymous
@PeeHaa No but I'm pretty hot aren't I? so who blames them.
 
ftr @PeeHaa I highly recommend not reading the source of ext/soap
it has a >1000 line function in it somewhere
 
Sorry @Nanne. I can't help you
 
Oh, something SoapClient related!
 
Shockingly... it's a pile of crap
@Sean is our resident soap expert by now though
 
12:21 PM
Oh and you know what that function does? It's the SOAP extension's own private HTTP client implentation, for no reason.
 
@PeeHaa no worries, thanks for responding though!
 
@PeeHaa More like foaming lunatic
 
The guy basically learned more about soap in one week than any of us care to do
Which is nice because we can bug him from now on about soap questions
@DaveRandom That I did know
 
@Sean ever heard of above issue / change in behavior? overriding __doRequest can be handy if you want to do your own call (e.g. using curl), but if the actual request isn't readable.
 
12:22 PM
@Nanne That looks like it was probably a bug the guy encountered
I wouldn't worry too much about that, I suggest you cross that bridge if/when you come to it, and I doubt you will
 
@dav
 
@Sean I need some help with Soap. Should I use a bar or liquid?
thats almost as bad as the wurst joke
 
aargh. typing is hard, again. @DaveRandom : i see your point. as i can't reproduce it anyway, its indeed probably moot :)
also, php7 it seems to work as expected, so taht's good. especially for SoapClient :)
 
php7? What other versions are there of php?
 
@Nanne ask them for a mcve
 
12:26 PM
@Nanne I can confirm that I have several things which use SoapClient in various ways running "fine" on PHP 7 (i.e. as well as can be expected when the huge drag factor of SOAP is involved)
 
@PeeHaa php6
 
I think everything I am running on 7 uses code generated by github.com/DaveRandom/WSDLDistiller @Nanne
 
@DaveRandom I thought you didn't drink anymore?
 
Wes
CSS class="block__element--modifier" design twitter.com/WesNetmo/status/778932618993737728
 
> so I threw it up
 
12:28 PM
@PeeHaa That is a tool to help me keep it that way
 
appropriate phrasing
 
inorite
 
:P
 
turns out I can't spell "distill" as well
 
@Nanne I've just joined from lunch so I'm not really understanding the question. Is the the $request that you're putting into __doRequest or is it the returned value?
 
12:33 PM
@DaveRandom I thought you were trying to be hip, like when people remove the "e" from "er" suffixes to name things like "flickr"
 
@Wes Lol :P I like BEM in moderation, it's very easy to go OTT with it though
 
Wes
it's madness :B
 
!!dad
 
I used to hate facial hair, but then it grew on me
 
@Sean well, the complaint was at both questions (not mine) that all of a sudden the $request parameter wasn't what they expected
 
12:39 PM
Does anyone know another language the has both == and === like PHP, but also has both strict and weak comparison operators like < and > ?
 
and this would be an issue, as i'd do for instance an override of that funciton, and then sending the request through curl or something.. but if that's not a readble string....
 
Or x/y - what is a sane syntax for a strict greater than comparison operator?
 
@Danack how would that work when comparing different types?
 
Wes
>== <== is easy, no idea about > <
 
@Patrick give a TypeError exception - context news.php.net/php.internals/96028
 
Wes
12:43 PM
$a = 10 gt 5; $a = 10 gte 5;
 
I think I want to be able to specify that the comparison should be strict.....I'm far less sure that a declare directive is a good idea.
 
@Danack I don't like that, having to always write === instead of == is mental overhead. Having to keep all those different operators in mind will just make things worse. I think a declare would be the better choice
 
Does anyone know if there’s a specific way to test Symfony Console tools with phpunit outside of a Symfony project?
Of course, without exec.
 
12:46 PM
@Patrick tbh, I just almost never user ==, so there's very little mental overhead for me.
 
@Danack yeah in PHP I don't use it either, but if you switch languages it sucks. And if you add more operators it will just make things more confusing
 
@Patrick I am agree with daniel san
@Patrick JS does it too
 
It will come down to always use this new comparison operator
@PeeHaa well that's not a language that I would use as a good example...
 
It is for the switching languages argument for me :-)
 
@Gordon <3
 
12:49 PM
Anyone?
 
"Sir, please step away from the keyboard. You are not to code ever again in your life." *puts him in handcuffs* https://t.co/c9Yw8MrpIQ
 
@Danack if you could ignore legacy reasons, wouldn't it make sense to use strict comparisons by default?
 
I don't think so. It would get in the way of being program quickly. Being able to do things like:
 if ($_REQUEST['numberOfItems'] > 10) {}
 
@Saitama what OS are you using for this?
 
Is a sane thing to do a lot of the time.
 
12:52 PM
I have encountered more than one bug because of people using ==
 
@DaveRandom linux (mint)
 
Having to add casts to every conversion of string -> int would be annooying.
 
@Patrick "That is never going to happen" is a good reason
 
@PeeHaa I know. But the declare might. I already have declare(strict_types = 1) on top of all my files anyways
 
@Saitama OK cool. Because what I'm about to push does not work sanely on windows because windows is retarded.
 
12:52 PM
@Patrick Yes but not enabled by default
 
@DaveRandom well true dat :P
 
@Patrick only if you turn off type juggling entirely
 
@PeeHaa Yeah, but we are talking about declare vs a new operator
 
> if you could ignore legacy reasons, wouldn't it make sense to use strict comparisons by default?
yes :)
@Patrick BTW the rfc that niki is working on already helps
 
so if I can jsut put a declare on top and write code in a nicer way because we can ignore legacy reasons this way, me gusta :)
 
12:54 PM
somewhat related
 
But littering my code with even more weird operators like ===, no me gusta
 
Noooo that's even worse than switching languages
That is just a terribed idea
You want to change the meaning of == depending on the declr?
 
@PeeHaa why not? we do the same with type declarations already
you can pick between strict and non-strict php
legacy code will still work, new code can be strict
 
I'd prefer inferred strict comparisons if possible, i.e. strict_types is on, the compiler knows the type of the operands (in simple cases) and can auto-upgrade to a strict comparison
 
I don;t get what that means
On what basis does it upgrade?
 
12:58 PM
function (int $i) { return $i == 42; } both operands are known to be int, no need to check if a type change is needed
 
What's the point in upgrading that?
 
I dunno, I should probably read up
 
Clearly I am missing something :P
 
or read the thread
 
I didn't. I am just shouting in here :D
 

« first day (2168 days earlier)      last day (2771 days later) »