« first day (2370 days earlier)      last day (2804 days later) » 

22:23
@tereško I tried what you suggested. It still seems like the internal rewrite is stripping POST.
or you are sending it wrong
what are you doing on the client side?
I'm not even worrying about the client until I get this fixed.
Right not I'm just using POSTman and Curl.
are you actually sending the correct content types?
and using the correct mode for adding request body?
@Allenph basically, click on the "code" link, taht is on the right side in Postman and show me the content
22:41
Hey folks :) Somebody up to help a php newbie?
I have a class structure very similar to what like Matthew answers here: stackoverflow.com/a/9207510/3459298
quick answer: never use static methods, unless you are using them as "alternative constructors"
I see, so you suggest that I just leave the new keyword and live with it?
what do you mean by "leave"?
what exactly is your question?
.... you might have missed that, but you still havent asked it
I was about to send it when you answered :)
the question is if I can pass the class itself and call the static method, instead of an instance of the class
basically I want to pass sometimes Foo and sometimes Bar (following Matthew's code), and abstract myself from the class name in the doSomething function
yes, there is a way to do this with procedural programming, but you really should use OOP approach instead
22:48
and I would prefer not to create an instance... however this syntax is not working
function doSomething($c)
{
$c::staticMethod();
}
why don't you want to create an instance?
I didn't need it at all, and in other programming languages I would go for the static method approach
PUT /user/2 HTTP/1.1
Host: api.sobox.dev
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJTb2JveCIsImV4cCI6IjIwMTc6MDQ6MTg6MTc6MDk6MDUiLCJsYXN0VXNlIjoiMjAxNzowNDoxMToxNzowOTowNSIsImlkIjoyLCJpc093bmVyIjpmYWxzZSwibG9nZ2VkSW4iOnRydWUsInBlcm1pc3Npb25zIjp7IjEiOltdLCIyIjpbXSwiMyI6W119fQ.OWIyN2ZkZDhhNjQ3ZGMzNGY5MWU4NmMwM2M3YTIzYWMwMzgyN2RmYjZlZDA5NzA3NmVmNTJmOTRmZjVjNzEzMg
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: f8b3bf4f-158f-a03a-7fca-3769abd433c0
@tereško Feel free to base64 decode my JWT. It's a fake.
22:51
@Allenph you have been looking at the wrong problem
but it seems that php works better with instances, I'll do it that way
it's the PUT that's causing the problem
thank you very much for your help @tereško
@EduardoPaez what the fuck did it even mean ?!?
2 mins ago, by Eduardo Paez
I didn't need it at all, and in other programming languages I would go for the static method approach
this made no sense
what "other languages"
@Allenph why do you expect any content in $_POST when you are sending a PUT request?
22:54
I had figured $_POST was just a poor alias for head.
There's no in-build functions to get data from a PUT? Wut?
I am not 100% certain, but that would be my guess
You're correct!
What the hell?!
@Leigh I want to have a non-ridiculous time function that returns an (almost) 64-bit number, but that only works on 64 bit versions of PHP. The feedback for it hasn't been positive.
@Danack is this hrtime?
because there are like 8 people on the planet, who use PUT and DELETE requests
22:56
(I'm +1 on hrtime btw)
Not sure - forgot what that function actually is. Just the 64bit unix time value.
Also, for the record, I have introduced functionality that exists only on 64 bit platforms, if you need a precedent (see 64 bit pack/unpack codes)
Not sure which function you're talking about if not high res timers, this could be it? linux.die.net/man/2/clock_getres (looks like 2x 32 bit values in a struct)
It is amazing to me that no one uses PUT. PATCH?
People use PUT
PATCH not so much
23:13
Yeah. My thoughts exactly.
I think having a different verb for update makes a lot of sense.
A different verb for "update the whole thing" and "update part of it"...not so much.
I guess it's more of a complexity overhead people would rather not be burdened with
especially if you're using schemas to validate requests
I'd be surprised if there's not tools out there today that make it easy though
CREATE and UPDATE logic is different...a lot.
And I would very much like to be able to add separate functions in my controllers for that.
What's stopping you?
Let me rephrase. I would like to do it in the way HTTP meant for us to do it.
Not by adding an additional data key value pair to tell me what I'm doing.
I guess I'm spending the night writing a parser.
Did you check out the library I linked you before?
23:19
I missed it.
it will make verb/path handling very easy for you
Oh, yeah. I saw that one.
I wrote my own router.
not sure why you need to write a parser then
It works surprisingly well, too. The one thing I hated about it @tereško fixed earlier.
@Leigh To parse the head data if it's a PUT.
I'm going to take a wild guess and say I can't use $_GET if it's DELETE, can I?
Depends :)
23:22
?
if you send a DELETE to /blah?key=value then $_GET will have the key/value
form encoded data will be in $_POST
Wut?
and body will have to be read from php://input
DELETE should not have variables in the head.
It can if you send them, they're part of the URI
23:23
I was mostly worried about ?key=value
If that works I'm good...because that's the only thing that should be there anyway.
Try it out :)
Anyway, I'm off to bed, good luck
Cheers.
$_SERVER documentation page needs improvement. – #74424
hi all
one question, could you edit a question right now?
when i try to edit i got the edit button unclickable and "Suggested edit queue is full"
anyone else with the same issue or is it just me?

« first day (2370 days earlier)      last day (2804 days later) »