Re: [PHP-DEV] RFC: Deprecate json_encode() on classes marked as non-serializable

2024-09-05 Thread Philip Hofstetter
Hello Rob, > To add to this, we apparently use json_encode at work to serialize custom > exceptions, which appears to work. This RFC would break that, I think. > > Exception is not marked as ZEND_ACC_NOT_SERIALIZABLE and would not be affected. Philip

Re: [PHP-DEV] RFC: Deprecate json_encode() on classes marked as non-serializable

2024-09-05 Thread Philip Hofstetter
Hello Rob, I think it would be good to list these non-serializable objects in the RFC. > It doesn't have to be exhaustive, but the list includes throwables, > weak-maps, weak-references, closures, fibers, etc. Some people may be > relying on this behavior (and I'd be curious to know that use cas

[PHP-DEV] RFC: Deprecate json_encode() on classes marked as non-serializable

2024-09-03 Thread Philip Hofstetter
Hello, As per my previous email to the list, I have now created the official RFC to deprecate calling json_serialize() on instances of classes marked with ZEND_ACC_NOT_SERIALIZABLE. https://wiki.php.net/rfc/deprecate-json_encode-nonserializable I have also created a PR with the implementation he

Re: [PHP-DEV] json_encode() and Generators / RFC Karma

2024-09-02 Thread Philip Hofstetter
Hi, On Aug 30, 2024 at 16:47:43, Claude Pache wrote: > > Note that the issue is not limited to Generators. For instance a Closure > object is also json-encodable but not serialisable. > > IMO, every internal class (not just Generator) that is marked as > non-serialisable, should also be non-js

Re: [PHP-DEV] json_encode() and Generators / RFC Karma

2024-08-30 Thread Philip Hofstetter
Hi John, On Aug 30, 2024 at 09:42:05, John Coggeshall wrote: > This seems entirely reasonable and I would welcome an RFC for it (unless > someone has a better idea as to how to handle this case). > > The other options I considered were to either materialize the Generator, but given that they c

Re: [PHP-DEV] json_encode() and Generators / RFC Karma

2024-08-30 Thread Philip Hofstetter
Hi Ilija, On Aug 30, 2024 at 09:49:14, Ilija Tovilo wrote: > > To grant you RFC karma, I need to know your wiki.php.net username. > Username is pilif Thank you Philip Hofstetter

[PHP-DEV] json_encode() and Generators / RFC Karma

2024-08-30 Thread Philip Hofstetter
Hello, In the aftermath of an internal refactoring of an internal code-base to turn something eager into something more lazy using Generators, it occurred to me that while PHP refuses to serialize() a Generator, accidentally running json_encode() over a Generator produces the worst possible result

Re: [PHP-DEV] [RFC] Lazy Objects

2024-07-18 Thread Philip Hofstetter
Hi, Minor point: Why is the $initializer return type null, instead of void? I >> don't see a purpose to allowing an explicit null return and nothing else. >> > > Updated to use "void". Both would work :) > > Super minor nitpick: You have updated the prototype, but not the explanation text which

Re: [PHP-DEV] [RFC] [Discussion] Resource to object conversion

2023-11-19 Thread Philip Hofstetter
Hi, On Thu, Nov 16, 2023 at 17:14 Jakub Zelenka wrote: > I will personally vote against this if there is no is_resource > change as I think it's just too big BC break even for 9.0 - it will likely > require massive update of many code bases. As someone maintaining a large code-base going back

[PHP-DEV] DateTimeImmutable::modify() return type: doc or language bug?

2023-01-03 Thread Philip Hofstetter
Hi, `DateTimeImmutable::modify()` is documented as returning `DateTimeImmutable`, but it seems to actually be more specifically returning `static`: https://3v4l.org/j9ZSo Now I'm wondering whether this is a documentation issue (where it should return `static|false` and has not been updated to ac

Re: [PHP-DEV] DB specific PDO subclasses questions.

2022-06-07 Thread Philip Hofstetter
Hi, On 6 Jun 2022 at 21:15:12, Dan Ackroyd wrote: > > 2. Other than the SQLite blobOpen functionality, does anyone know of > any other functionality that is exposed by SQLite or Postgres that > isn't currently exposed through the magic PDO methods? > a wrapper around PQescapeIdentifier in lib

[PHP-DEV] 8.1 / Exception / Property Type / Backwards compatbility

2021-08-10 Thread Philip Hofstetter
Hello The following valid <= PHP 8.0 code that intends to make the $line property public is a fatal error in 8.1 class FooException extends Exception { public $line; } However, the fixed code for 8.1: class FooException extends Exception { public int $line; } Is a fatal error in <= 8.

Re: [PHP-DEV] Null-safe property access in interpolated strings

2020-08-10 Thread Philip Hofstetter
Hi, On Sun, Aug 9, 2020 at 8:34 PM Jordi Boggiano wrote: > Can't say I'm big on interpolation but I'd definitely expect this to > work because why not? A reason why not is because it will break backwards compatibility with existing (though admittedly unlikely) code which also can't be fixed by

[PHP-DEV] ZEND_ENGINE_4 define?

2020-08-09 Thread Philip Hofstetter
Hello, I'm currently looking into porting some extensions (both internal and public) to PHP 8 while still keeping support for PHP 7 (for the public ones) and PHP 5.6 (don't ask :-(). In many cases, I've been using the ZEND_ENGINE_3 define to handle the PHP 5/7 difference. Now, the Zend Engine ve

Re: [PHP-DEV] Adding TypeError and ValueError to count() function

2020-01-21 Thread Philip Hofstetter
Hi, On Tue, Jan 21, 2020 at 6:17 PM Nikita Popov wrote: > > In the cases you encountered, do you know what type count() was used on? > Was it null? false? Or something else? > > Nikita we were in a similar boat as Björn to the point where we manually patched PHP in production in order to not e

[PHP-DEV] Re: FFI extension / NULL-Checks

2019-09-09 Thread Philip Hofstetter
tests. Philip On Mon, Sep 9, 2019 at 8:03 AM Philip Hofstetter wrote: > Hello, > > (I'm writing to the internals list because I don't think that at this > point, FFI usage is wide-spread enough to get an opinion on other venues) > > maybe I'm just stupid, bu

Re: [PHP-DEV] FFI extension / NULL-Checks

2019-09-09 Thread Philip Hofstetter
On Mon, Sep 9, 2019 at 10:13 AM Stanislav Malyshev wrote: > > isset($err) > > $err[0] != null > > -> is always true, regardless of whether func as assigned an error or not > > > > $err[0]; > > -> segfault > > This is a bit confusing - if $err[0] segfaults, how it can be != null? > Does this beha

[PHP-DEV] FFI extension / NULL-Checks

2019-09-08 Thread Philip Hofstetter
Hello, (I'm writing to the internals list because I don't think that at this point, FFI usage is wide-spread enough to get an opinion on other venues) maybe I'm just stupid, but I think there has been a slight oversight in the API design for the FFI interface. My problem is with functions that r

Re: [PHP-DEV] [RFC] Reclassifying engine warnings

2019-08-28 Thread Philip Hofstetter
Hi, On Wed, Aug 28, 2019 at 11:33 AM Nikita Popov wrote: > > I think it's time to take a look at our existing warnings & notices in the > engine, and think about whether their current classification is still > appropriate. Error conditions like "undefined variable" only generating a > notice is

Re: [PHP-DEV] PDO native JSON / array support

2017-07-27 Thread Philip Hofstetter
Hi, I few years ago, I did a throwaway implementation for this for reading: https://github.com/pilif/php-src/tree/pdo_pgsql-improvements This supports columns of type jsonb, json and text[] and I was considering also adding support for the various timestamps, date and so on. Generally, interest

[PHP-DEV] stat cache / still needed these days?

2016-07-25 Thread Philip Hofstetter
Hi, I have just reported #72666 (touch() works differently on plain paths and file:// paths with regards to cleaning the stat cache) and I would gladly provide a PR with a fix and unit tests. However, before I start working on this (well - it would be an easy fix), I would like to question whether

Re: [PHP-DEV] [RFC][DISCUSSION] Session ID without hashing

2016-04-12 Thread Philip Hofstetter
Hi On Tue, Apr 12, 2016 at 10:21 AM, Michael Wallner wrote: > On 08/04/16 04:17, Yasuo Ohgaki wrote: > >> PRNG like /dev/urandom is supposed to be secure, but fair point. It >> may be good idea keeping old hash based session ID just in case >> someone find vulnerability. I suppose it's unlikely w

[PHP-DEV] PHP7 / foreach / references / ugly code / discrepancy to PHP 5.6

2015-11-10 Thread Philip Hofstetter
Hi, I'm having a cause of slightly ugly code that runs differently from PHP 5.6 to PHP 7 and I don't think this difference is documented, nor expected. As I'm not sure whether this is an intended change or not, I'm asking here firstr before making a bug report. The code in question is $b =

[PHP-DEV] Bug 70279

2015-09-21 Thread Philip Hofstetter
Hi, I have done a bit of investigation into bug 70279 and I'm at a point where I need an opinion of somebody with fastcgi experience. The bug was caused by f20118aa669f9992fee8a64024e623805669391b ( https://github.com/php/php-src/commit/f20118aa669f9992fee8a64024e623805669391b) which IMHO has a m

Re: [PHP-DEV] Change IntlChar::getNumericValue() to return something less horrible when the char is not numeric?

2015-07-09 Thread Philip Hofstetter
Hi On Wed, Jul 8, 2015 at 9:45 PM, Stanislav Malyshev wrote: >> I would change the function to return NULL instead; what do you think? > > While the exact value of U_NO_NUMERIC_VALUE looks weird, nobody is going > to use it directly, you'd be using U_NO_NUMERIC_VALUE. Comparing to it > doesn't lo

Re: [PHP-DEV] date extension / Type Hinting

2015-07-02 Thread Philip Hofstetter
Hi, On Thu, Jul 2, 2015 at 4:52 PM Anatol Belski wrote: > please read this thread for more info > https://github.com/php/php-src/commit/8e19705a93d785cd1ff8ba3a69699b00169fea47 > . > yeah. I also understood Nikita's response. I guess you can close the two bugs for now as this really isn't fix

[PHP-DEV] date extension / Type Hinting

2015-07-02 Thread Philip Hofstetter
Hi, as this probably requires some discussion, I'm coming here to ask. I'm talking about bug 69977 and 61483: Both are about the fact that it's currently not possible to properly type-hint descendant classes of DateTime and friends. The reason is the missing use ZEND_ARG_OBJ_INFO, so right now,

Re: [PHP-DEV] Fwd: [PHP-CVS] com php-src: Fix tests I broke with the E_ERROR > E_RECOVERABLE_ERROR change: tests/output/ob_010.phpt tests/output/ob_011.phpt tests/output/ob_start_error_005.phpt

2014-12-29 Thread Philip Hofstetter
Hi, On Mon, Dec 29, 2014 at 2:42 PM, Levi Morrison wrote: > 1) providing a non-callable type is a logical error even if you > suppress it with $throw = false yes. > 2) and parameter types are the standard way of checking this, not some > odd boolean as another parameter yes > 3) this would

Re: [PHP-DEV] [RFC] UString

2014-10-21 Thread Philip Hofstetter
Hello Tangentially related: On Tuesday, October 21, 2014, Dmitry Stogov wrote: > > > It won't allow Unicode strings as array keys; I wish there was a way for specific objects to opt into this. Using __toString() we have something that mostly behaves just like a string and can be used whereve

Re: [PHP-DEV] PHP 5.4.33 RC1 => mod_proxy_fcgi still broken

2014-09-05 Thread Philip Hofstetter
On Fri, Sep 5, 2014 at 1:18 PM, Remi Collet wrote: > 2. ProxyPass Configuration > > ProxyPass /proxy/ fcgi://127.0.0.1:9003//var/www/html/ > > URL = /proxy/info.php/a/b?q=a > SCRIPT_NAME = /proxy/info.php/a/b > => Broken This is bugging me too on my development machine where I'm stuck at Ap

Re: [PHP-DEV] RFC: Move phpng to master

2014-07-22 Thread Philip Hofstetter
Hi, On Tue, Jul 22, 2014 at 3:18 PM, Etienne Kneuss wrote: > This means https://wiki.php.net/phpng-upgrading should be completed to > reflect all changes. as a pure consumer maintaining some internal extensions, I would very much like to see this too, at least when you decide to go ahead with t