#PHP jobs increasingly seem to want experience with a framework, preferably Laravel.
I've been too busy working with MediaWiki and writing my own framework to learn another one. Am I doomed?
Disemployed in Durham
P.S. Do I really have to learn #MVC or am I also additionally doomed because I doan wanna?
Wow... is there really no clean way to detect an improperly serialized string in #PHP?
I tried the
@ technique, and it still throws a fatal error.
The only solution I can find seems to be basically reverse-engineering the format and checking for likely issues before trying to parse it: https://stackoverflow.com/questions/1369936/check-to-see-if-a-string-is-serialized
As a result of this, I have now used code from StackOverflow absolutely verbatim. Just yesterday I told @eryn I had managed to avoid ever doing that... :D
I'll take consolation from the fact that I'm doing it as a kluge around a bug in #MediaWiki rather than in my own code.
It's really kind of irritating that #PHP native exceptions don't seem to ever set a numeric code, making it more difficult than it should be to detect specific error conditions -- especially when part of the error message is a variable, as in
Class '[name of class]' not found
I'm going to have to use regex for this. It should just be a numeric code, but the
getCode() for this error is 0, as it is for pretty much all of them as far as I can tell.
Thinking about it... in #PHP, why are
traits even different things?
Everything you can do with an
This is functionally the same as defining an
abstract public function in a trait.
This is functionally the same as a trait
use-ing another trait.
This is functionally the same as
use-ing a trait that consists entirely of abstract public functions.
This is the one thing a trait cannot do -- but I don't understand why it was done that way.
Note: this seems related to my trait implements wishlist item from earlier. At first I thought that they might be in conflict, but on looking at the syntax in more depth, I don't see how. A trait that uses/extends another trait is also declaring abstract functions in that trait as an implementation requirement.
Putting both of these suggestions together would both simplify the language and make it more powerful, I'd think.
#PHP experts: is there any non-destructive way to tell if a variable contains a reference rather than a literal value?
I keep forgetting to include the keyword
function when declaring functions in #PHP. Does this mean my brain is pining for C++ or something? 🧠
There needs to be a companion to the
final keyword in #PHP.
Background: The "final" keyword indicates that a method cannot be overridden in a child class.
Wish: There needs to be a
first keyword to prevent accidentally creating a method ancestor which might get completely bypassed because a descendant doesn't call
parent::[method] because it doesn't expect one to exist.
Either that, or a way to allow calls to
parent::[method]() even when there's no method ancestor.
...or else a way to define a method such that each generation gets called automatically -- except that takes away sequencing control, which would cause problems.
You can make #PHP throw an error if a function is called without expected arguments, but not if a function is called with more arguments than expected.
I think maybe #PHP8 fixes this by allowing "void" as an argument type? I don't yet have a system with PHP8 on it, though, so I don't actually know.
If it doesn't, then this is a #softwareGripe.
a herd of cats, most of whom are asleep at any given time
supreme Uberwensch of toot.cat
still going largely on potential.
On the internet, everyone knows you're a cat — and that's totally okay.