« first day (1857 days earlier)      last day (3084 days later) » 

6:06 PM
Can php set status code 501 automatically somehow? and if so, can I disable it..?
If I echo "wtf" or what ever before the function creating the problem, statsu code 200 is used and the expected output is rendered
 
I know that 500s can be generated automatically under certain circumstances, but I've never seen 501 created automatically.
 
I'm sing that
*I'm using that
 
the I don't understand the question and/or the point
 
$viewModel = $frontDispatcher->dispatch($dispatcher);
echo json_encode($viewModel);

Renders 501

echo "wtf";
$viewModel = $frontDispatcher->dispatch($dispatcher);
echo json_encode($viewModel);

renders: "wtf{"message":"deleted"}"
Using method "DELETE"
With method "GET" it works fine..... just tried
 
6:25 PM
Same problem with PUT, with POST it works however
 
you are making no sense
have you tried actually looking at the error log?
 
There is no error, just the status code
 
or are you using some shitty framework which swallows all the error messages
 
No, the code is written by me.. but it's nothing in there, just dummy code
all it does is return an array ["foo"=>"bar"]
it makes no sense, like you say.
 
6:28 PM
@ErikLandvall something will be setting the status code....it doesn't get set magically. Just check everywhere that is calling header() in your code...
 
nothing is calling heders. I can give you all the code, hang on .. @Danack
 
php does not magically return 501
it's done by you, or by your webserver's config
 
@tereško then explain why there's no errors! I'm telling you, it makes no sense.. it's jst layers of abstractions in the code that works with one method, but not the other.
 
have you acctually tried to send a PUD/DELETE request to and empty php file?
do I need to teach to basic debugging?
 
@tereško Pls, don't be descending. I tried all sorts of stuff before I asked here. I'm not a scrub... 10years plus experience. the code works, even with DELETE if it doesn't go through the layers of abstractions... I'm trying to show you the flow, just hang on
 
6:37 PM
"then explain why there's no errors!" - your code isn't doing what you think it's doing. The reason why putting an echo in, is that it makes PHP sends the headers including the status code. You ought to make sure that you have error reporting properly enabled, because it sounds like you don't.
 
I am confused
are there errors are are there no errors
 
"I'm not a scrub..." - and yet your code isn't working, and somehow it's our fault for trying to help.
@tereško want to place a bet on it being a custom error handler that is logging (but not displaying) the error, and setting the 501 status code?
 
it could be something to to with webserver itself, since 501 is a pretty specific http code
 
ah, a fine day as usual. 'morning
 
@Danack my bet is that it's either bad webserver config or routing
 
6:42 PM
Shall we say 500 rep?
 
done
 
@Danack How do you see it as your fault? did you feel I put the blame on you?
any way...
 
if this were a hockey team, I'd be "good show guys"
 
I Think I got it all in there, just trying to show the code that I'm using, hard to do with all thees abstractions, but with out the abstractions, the code works..
 
@ErikLandvall 501 is method not allowed. You're getting errors when issuing a DELETE verb. Go look at the docs for your web server software and determine why it's rejecting the verb. Maybe you have an extension installed that acts on the DELETE verb, or maybe you've otherwise expressly told it to forbid that verb.
Oh, I see you've covered that already.
 
6:47 PM
@Charles But it works, outside of the code posted. .
...yhea :)
 
Regardless, as has been stated, PHP won't return 501 on its own.
 
Yhea, that's what I heard, my original question was regarding just that
 
@ErikLandvall "then explain why there's no errors!" - right there is where you're putting the blame on someone else for your code not working. And the code you linked isn't runnable...and I think the error is not in the code you're looking at.
 
A bit frustaded here, I could ofc just say screw it and use GET.. but this is eating me up
 
Don't use GET for anything that has side effects.
 
6:49 PM
@Danack No, that's an argument. Sense there's no errors, just the status code.. that's what's starnge. It defies the problem
 
Don't forget that the whole verb + resource thing is really only a guideline. There is no shame in attaching actions to resources using URLs alone.
 
Are you able to link to the complete code base?
 
Not for the moment, @Danack my day ended 3 hours ago, was suppose to have a repo set up today actually.. will try and make time for setting up a repo tomorrow or something. Will try and make a smaller code base to re-produce the issue as well. Thanks for your time all.. / Broken and failed coder going home for the day
 
> If I understand this correctly, different files are stored in different ways; for example an image data is stored as binary inside a jpg file. But not all file use binary.
 
6:56 PM
@ErikLandvall do you have xdebug fully set up? You could use that for a line-by-line stepping
also, another question is: what's the HTTP code if you exit before calling $frontDispatcher ?
 
sup everyone
 
hello
 
I had a productive weekend :D
 
@ScottArciszewski moin
 
good to hear
 
7:02 PM
still need to confirm that drupal vuln but I managed to find one in zend-crypt :D
 
@salathe gophp7 is some releases behind. Just sayin'
 
looks like joomla 3.5 is going to less insane and terrible too :)
progress
 
@rdlowrey How can we realize something like monolog's fingers-crossed handler in Aerys? /cc @bwoebi
 
Buffer up what would be delivered to the callables/watchers and deliver them all at once?
 
I need a beer
 
user895378
7:18 PM
@kelunik I don't know what monolog's fingers-crossed handler is :)
 
 * Buffers all records until a certain level is reached
 *
 * The advantage of this approach is that you don't get any clutter in your log files.
 * Only requests which actually trigger an error (or whatever your actionLevel is) will be
 * in the logs, but they will contain all records, not only those above the level threshold.
 
I feel like, after they release the patch for ZF2, I'll have run out of big PHP projects to find vulns in
 
@kelunik fingers-crossed handler?
 
@Danack Question is how to bind them to a certain request.
@bwoebi Read the message two above yours.
 
Yay, after much dicking around, I can use:
"autoload": {
    "files": [
        "src/**/functions.php"
    ]
}
 
7:25 PM
@kelunik well, I don't want end up having an OOM due to all the buffered logs… looks fine for short-running scripts, but not possibly infinitely running scripts?
 
That's why it has to be request bound.
 
@DanLugg ......so you've fixed the problem of your server being too fast as well!!
 
@Danack ;-)
Hilarious, but not applicable, at the moment there's a grand total of 4 functions.php files floating around.
I doubt there'd be much an impact if that number became 40.
 
For the record - I have officially given up and am using static methods in place of functions. Although it makes be feel a bit dirty, it stops me having to worry about loading functions, having a single file with ALLTHEFUNCTIONS.PHP
 
^^ I was doing this, and now I'm back on functions.
Manages the desire to leverage private static state.
Though, you can just static whatever anyway.
 
7:28 PM
@Danack humm, why? after all, it's just searching once at startup
 
@Danack No, I solve that problem with calling exec('composer dump-autoload') in my bootstrap.
 
@bwoebi I don't use Aerys.
 
I meant when you install composer, like @DanLugg shows
 
The dump-autoload is still a shitty solution...the problem is that the code is being loaded on each request. A modern-ish CPU has say 12 GB/s of memory bandwidth to play with.
(btw I might be wrong on the following, but don't think I am)
If you're loading all possible functions needed on each request, the code gets copied from OPCache to the process running the individual request.
Even if you only want to aim for 500 requests per second, that is about 24 MB of memory bandwidth per request......
So loading all of the functions eats a shed-load of that memory bandwidth up....but even worse, the dumped autoload file for even moderate sized projects can easily get to 5 megabytes.....
Yay - even without any processing of code, your system gets completely constrained by just copying data around uselessly.
Or, you could just give up and only load functions when needed....which is what happens automatically when you use static methods....
 
@Danack but you still load the whole class of static methods
 
7:42 PM
@bwoebi There can be multiple classes, that's the difference.
 
functions.php is basically the equivalent to the bloated up util god class with all static methods
sure there can, question is how often it makes a difference…
 
@bwoebi I don't put them all in one class. Just group them into sensible collections. And also, it means that if I pull in a dependency that is only used in particular scenarios (e.g. deploying the application) and it has a collection of functions, those functions don't get loaded for each request.
 
yeah… we definitely need function autoloading for that.
 
yay, beer
:D
and now back to watching Shoutcraft Invitational
 
@PeeHaa PR or STFU
 
7:48 PM
@tereško the status code before the front dispatcher is just an ordinary 200. Let's not get into it right now, I will set up a test case that can re-produce the issue if I won't solve it..
 
*checks PRs* oh.
 
/me clones project. WTF!?
:P
Think people will notice if we put dr evil up as favicon? :)
 
user895378
+1 for Dr. Fevilcon
 
This "Aerys uses 100% CPU" issue is really strange...
 
8:09 PM
totally… I could reproduce it exactly one time when killing the two workers via kill -9 manually…
Other times, the worker never was notified that the stream was closed at all???
/me gives up … (for now at least.)
I hate things I can't consistently reproduce…
 
I can reproduce it constantly locally and could reproduce it constantly on all other servers...
 
I think I am starting to get unit testings
its taken a while
 
@kelunik there is also a worst case scenario: "there is no bug to fix" =/
if it's cause by something in php itself, then the Aerys is fucked for the foreseeable future
 
@MadaraUchiha I gave a vote to you for "2015 Moderator Election", I hope you be chosen.
 
hmm in PHPunit, should I test exceptions by annotation or shouldThrow()?
 
8:19 PM
Guys... What am I doing wrong here: $needle[0] = '%one%';
$needle[1] = '%two%';

foreach ( $needle as $request ) {
$requests .= " text " . $request;
} - Invalid argument supplied for foreach()
$needle = array ('%one%','%two%');

foreach ( $needle as $request ) {
$requests .= " text " . $request;
} - ok
 
@EquinoxMatt you probably should, but it's rarely cause for major build-breaking bugs
 
Isn't $needle[0]=1; $needle[1]=2; equal to $needle = array (1,2)?
 
yes - equal
 
We should have committed the composer.lock file... @bwoebi
 
The first case gives me "Invalid argument supplied for foreach()"
 
8:22 PM
@tereško ok :)
 
@ЗахарJoe because you are writing shit code
start by initializing it as an array: $needle = [];
 
@EquinoxMatt There is somethign called shouldThrow?
 
@PeeHaa - I meant andThrow() when mocking a method
 
@ЗахарJoe I run this code - no errors))
 
getting myself confused
 
8:24 PM
@tereško Thanks. I had a lingering suspicion... but why? Why must it be initialized?
 
@EquinoxMatt I prefer @expectedException in docblock
 
The biggest problem I have is working out WHAT to test. In this case I am expecting a result from the DB, I know I should test the actual DB, but I assume it is correct to simulate how to handle the result of the DB
@tereško That is what I am using now
 
@EquinoxMatt There is something called andThrow?
 
@EquinoxMatt you shouldnt unit test mocks :)
 
8:25 PM
Does anyone care to answer a question about php object modeling and associative tables?
 
@EquinoxMatt That's not phpunit
 
@tereško hmm, but you shouldn't test the DB either?
 
DB is not a mock
 
@PeeHaa yep, just realised. Sorry, still quite new to phpunit/mockery
 
I mean, I got away everywhere else without initializing. Why must it complain now?
 
8:26 PM
mock is a "fake object" that you construct to fulfill dependencies for the thing that you need to test
 
@tereško Yep, I get that. But do I not need to test how my code handles a incorrect value from the DB?
 
then test that exact behaviour
 
Yes but I thought unit tests were not meant to use DB connections?
 
Let's say I have a super simple object that has an ID and a Category (foreign key pointing to category table). How would that object be modeling in php?

class Simple{
 
@EquinoxMatt only reason for testing exception that was thrown by a mock is if the expected behavior is tho let the exception to bubble through the tested class
 
8:29 PM
Let's say I have a super simple object that has an ID and a Category (foreign key pointing to category table). How would that object be modeling in php?

class Simple{
private $id;
private $category;
}

Corret?
 
@tereško Well in this example, the code checks for the existance of a value in the DB, and if it does, throw an error - how would I test that?
 
@JohnHargis you are looking at this all wrong. There is no need for your DB to be mirrored by your classes.
@EquinoxMatt what throws the error?
also, UPDATE .. ON DUPLICATE KEY INSERT .. is your friend, if you are stuck with MySQL/MariaDB
 
@tereško - the service layer. It calls the DB layer to check if a value exists, and if it does, throw an exception
 
so, the persistence layer throws the exception
right
and you are testing something in service layer
 
No, it returns the value, it doesn't care itself what the data is
 
8:32 PM
wat
 
@tereško - it is an ID, I test for 3 things. I want them to be able to change their user ID, but obv not to one that already exists
 
@EquinoxMatt are you aware that PDO will throw an exception if you try to vioalte UNIQUE contraint?
 
@tereško - the ID is made up off a combination of columns ...
 
well, UNIQUE can be applied to a composite key
 
true, I didn't think of that
so make a key/index, with the three columns concerned
 
8:35 PM
yes, and PDO will be the one throwning the exception
and you dont unittest PDO
you just test how the class handles an exception from the PDO instance
 
but that brings me back to my original point though, do I still not need to test how my app handles that PDO exception?
 
@tereško I guess what I am getting at is, if $category is equal to a foreign key, then is it bad that I make a call to the DB in the getter method when I want to get the actual name of the category?
 
@EquinoxMatt well. You mock the exception. But your test does not expects the exception. It only cares if YOUR class did the right thing with it
 
@tereško right ok, thank you for patience!
 
if the right thing is "do nothing" then your unit test should also check that "nothing was done when PDO threw an exception"
@EquinoxMatt the point of the unittests is to only test if one particular class is doing what it should be doing.
... also, usually you should test only the public methods
usually
 
8:39 PM
@tereško OK. Yeah, I learnt that the other day when I started getting confused about reflection
 
actually if you really need to test public or protected methods, you just extend the tested class ... but at that point you begin using unit tests purely as a development tool not a testing/QA tool.
(I sometimes write unit test for private/protected methods, when I am developing some really confusing algorithm and need to make sure that some recursive nightmare actually works as I think it should be working) << this is not a good way of doing things
 
@tereško - That is good in a way though right? Unit Testing is primarily for tests but also makes you think about your architecture, coupling etc?
 
nope
 
I only do this for methods like "balance" for an AVL tree. Balance is not something you can outwardly see but it is an often reason for the structure to fail.
 
@EquinoxMatt that's called "integration test" and you probably should try to minimize the use of those.
@EquinoxMatt vimeo.com/80533536
 
8:44 PM
@kelunik why?
 
@tereško - thank you. I will take a look.
 
why there is still no oneboxing for vimeo ?!
 
So we can test it with older dependencies to notice since when that 100% CPU thing exists.
 
@kelunik I doubt it's related to any dependency.
 
@JohnHargis wut
I have no idea what you tried to say
... then again, this is the second beer
 
8:46 PM
@tereško uhm… bad enough animated gifs can be oneboxed…
 
Just another quick one, should repositories be allowed to call one another?
 
@bwoebi there should be a "collapse" button added to all one-boxes
 
@tereško nah… an expand button.
 
probably
@EquinoxMatt IMHO: no
but that's just my opinion
 
@bwoebi Nope, collapse, with expand there's no more reason to onebox something, I can just as well click on a link then.
 
8:48 PM
@tereško fair enough
 
.. I actually dont use repositories in my own code
 
@kelunik that's the point.
 
@EquinoxMatt do they model a hierarchy?
 
@bwoebi You insisted that I add that feature to my chat.
 
@kelunik yeah, for static non animated content.
 
8:50 PM
@BenjaminGruenbaum Yes, I think so. When the user changes their ID, I want their other records to also be updated. I wasn't sure if I should call the respect repositories via the service layer, or call one repository and let it do the work
 
@bwoebi Well, just don't animate gifs but show a static version and animate on click and stop animating on click again.
 
@EquinoxMatt just make sure changes that affect multiple tables happen in a transaction.
 
@BenjaminGruenbaum Will do
 
@kelunik that's fine.
 
Also note - a repository doesn't have to be for a single table.
In fact - that's usually not the case
 
8:52 PM
@BenjaminGruenbaum Yeah that is something I had a look around about a few days ago. The general consesnsous seemed to be mixed, leaning towards a repo having access to several tables
@BenjaminGruenbaum I am using a datamapper orm as my persistance
 
what is "datamapper orm"?
I hope you are not talking about that CodeIgniter atrocity (which actually implements active record)
 
@tereško No, give me a little bit of credit ;)
 
credits have to be earned
 
Honestly, I changed my feeling about ORMs from "sometimes" to "should not contain any logic except for querying and adding - certainly no joins or dynamic proxies - should just map to objects".
Because indexed views.
 
@EquinoxMatt seems you are a saucy person ...
 
8:55 PM
@BenjaminGruenbaum so your not keen on the idea of $blog->posts then? Or have I completely misunderstood you.
@Shafizadeh Thanks?
 
@BenjaminGruenbaum that's a nice change. It's almost the same feeling as my roommate' madagascar cockroach growing up
:P
@EquinoxMatt your objects should not have public variables
public vars are only for "data structures"
for example is you are building a tree and your nodes have branches that are public vars
fuck .. the second beer is at almost gone
 
what is the price of each beer?
 
around $1.50
 
Bargain
 
I tend to buy beer that actually taste good
 
9:08 PM
how many beer you drink in the month?
 
hmm ... about 10-12 liters in total, I think (each bottle is 0.5l)
 
so you pay almost 30$ in month just for beer :-)
 
that's about right, yes
 
@tereško the problem isn't ORMs, it's the fact developers who don't understand the tradeoff use them too often.
It's a very dangerous abstraction.
 
what happens when you drink a beer?
 
9:12 PM
true
 
you will be relax?
 
Like goto sort of, it can be very useful in some scenarios. However I'd rather not use it and not read code of other people who use it.
 
@Shafizadeh if I drink as single beer: absolutely nothing. But it's really complementing the food. Two beers get me relaxed. 4 beers and I am actually kinda drunk.
 
I'm really leaning towards abstractions that follow the rule : "make programmers not make bad choices when deadlines are imminent"
 
@tereško ah
 
9:16 PM
@Shafizadeh it's also depends on the weather. If it's 35°C outside, a normal person can get quite drunk from a single beer.
that's probably why cultures which restrict use of alcohol tend to cluster closer to the equator
 
oh, I really did not know ...
I have never drinked beer, I like to test it, but I can not find a beer in my country
 
it probably would be pretty bad
I have hear that beer in India is about as good a bottled cat piss
... I wouldn't expect any better in Iran
 
you might be better off with some wine
 
wine is more rare than beer, because it is banned by my religious
 
9:24 PM
ouch
you people are no fun at all
 
:-)
I don't know, maybe this kind of living is better ... or maybe yours
 
mine, we have unlimited optical internet
:P
 
:)
@tereško oh one thing, what is your opinion about "love"?
a relationship with a girl
 
lol ... you are again drifting in the "private information" territory :P
 
@Shafizadeh - Why did you refer to me as 'Saucy' earlier?
 
Anonymous
9:32 PM
@Shafizadeh I'm with you. It is better to live that way
 
I did not say "your love", I told "love". you think it is just in stories, right?
 
Anonymous
If I was a leader, I would make it illegal too.
 
Hm, GitHub does now actively encourage to enable protected branches.
 
@samayo why? :-)
@EquinoxMatt Because you expected to Teresko give you some credit ..!
 
ahhh
 
9:38 PM
@kelunik can I disable that account wide please? :P
 
@tereško still I like to know your opinion about "love" ..! it is nonsense or it can be a real thing?
 
@Shafizadeh how do you know until you have found it?
 
@DaveyShafik Just needed it for a PR rebase. ;-)
 
Anonymous
@Shafizadeh nonsense.
 
@EquinoxMatt now, I just want to know Teresko's opinion about "love". Honestly I believe Teresko had experienced a bad love failure ... I want to know my thought is correct or not!
@samayo thanks for telling me your opinion
 
9:42 PM
@Shafizadeh If he wants to respond is up to him; please don't bother him about it.
 
Anonymous
@Shafizadeh what did poor @tereško ever do to you? First you said he was schizophrenic and now you said he experienced 'bad love failure' :D
 
What a strange conversation
 
Anonymous
hey, it's a strange world :)
 
@LeviMorrison ok
 
@samayo yes, it is
 
9:44 PM
@samayo ha ha ha! (that was funny). actually nothing, I just like to know more about him, I don't know why
 
Anonymous
9:57 PM
@Shafizadeh because you are new
 
Anonymous
I miss being a first-timer. In your first year, you'll feel free to act and speak as you are used to in your more open society. In Europe and the West however, the etiquette is a bit different. Little by little you have to learn to be a little less of yourself, and do more of political correctness, social justice to fit in.
 
Anonymous
So, to sum it up, after a year ... you'll change your personality.
 
@samayo I hope so
 
@Shafizadeh "I just like to know more about him" - we've had this discussion before. Hassling people online to try to get personal information about it is highly inappropriate. Please stop doing it.
 
@Danack ok
ya look, I am usually a polite person, and I don't interference at people lives. But in this case (Tesresko) I liked to know more about him because he is different than others a bit and he is kinda pattern for me. I try to behavior like him, so for doing that, I need to more data
anyway ok, I learned my lessen, I never ask about him anymore
 
10:09 PM
that was just creepy
 
Abe
evening \o
 
ok, as I said, I would never ask anymore
@Abe o/
 
Anonymous
@Shafizadeh Internet rule #1: don't take anything personally!
 
again, I got it
 
Abe
i was enjoying a 2 weeks kinda vacation... but i just have been given some work to do -__-
just in the middle, to spoil the vacation entirely
 
Anonymous
10:14 PM
That person is going to that special place in hell.
 
@tereško can I sign up to your fan club to?
 
please dont
 
Uh… just normal PHP things going on in here, right?
 
claramente
 
10:24 PM
jajaja?
 
Abe
neinneinneinneinnein
 
10:42 PM
Hi everyone :)
Hope all are fine
I have this "where" in query: AND type_item.name NOT REGEXP '^[a-z]+' COLLATE utf
but I always getting results like č
 
Abe
and is that wrong? you need to provide more details if you want help
 
hello
i want a good php course
 
Abe
i don't think COLLATE is affecting [a-z] at all if that is what you mean
 
can anyone help me ?
 
@Abe I need some modifier, but I don't know which :D
@MohamedHassan Yes?
 
10:50 PM
okay thanks @VeeeneX
 
What is the difference between parsing and deserializing?
 
@VeeeneX
 
@DanLugg Noob answer: You can parse unknown data, but you deserialize data known to you.
 
@VeeeneX This is related to case insensitivity.
 
@kelunik I don't get it
Funny this works : ^[a-z-a-ž]++
But not in SQL
 
10:59 PM
Oh, you want to exclude those. In that case č is not between a and z.
 
I'm trying sth like this regex101.com/r/vY4nB5/1 but in SQL
 
ThW
11:25 PM
VeeeneX Which regex syntax supports your SQL server and have you checked for unicode property support?
 

« first day (1857 days earlier)      last day (3084 days later) »