Re: Custom object equality
| From: | Craig Francis | Date: | Thu, 19 Oct 2023 10:07:54 +0000 |
| Subject: | Re: Custom object equality | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-121429@lists.php.net to get a copy of this message | ||
On 18 Oct 2023, at 13:50, someniatko <someniatko@gmail.com> wrote:
> There were already suggestions on the mailing list to allow "overloading" existing
>
== operator, and some suggestions went even as far as overloading
> <, >= etc operators.
Slightly off-topic, but concatenation?
Just as a possible feature... for my sins I'm the database component maintainer for WordPress,
and I'm currently getting wpdb::prepare() to work with the
literal-string type, where I added support for escaping identifiers (field/table
names). This function works like sprintf(), with the SQL being the $format
argument, and then user values; from that it returns an SQL string with escaped values (yes, I know,
parameterised queries are better, but we work with what we have)... developers often concatenate
these together, but I was wondering if I could return a stringable value-object, so when they are
concatenated, a new value-object could be created instead, so we can verify (ideally at runtime)
that all values have been escaped correctly (and maybe use parameterised queries).
Craig