Re: [PHP-DEV] Re: PHP 8 is_file/is_dir input handling

2020-12-02 Thread Stanislav Malyshev
Hi! Just to reiterate, the previous implementation was also bad - it returned an entirely undocumented and unexpected null value. PHP functions always returned null on bad parameters, so it's not exactly unexpected. -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Developm

Re: [PHP-DEV] [RFC] Deprecate passing null to non-nullable arguments of internal functions

2020-12-02 Thread tyson andre
Hi Nikita, > I've put up an RFC to make the handling of "null" arguments consistent > between internal and user-defined functions: > > https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg > > I started an informal discussion for this change during the 7.4 cycle > already, but decided t

Re: [PHP-DEV] Re: PHP 8 is_file/is_dir input handling

2020-12-02 Thread Christoph M. Becker
On 03.12.2020 at 00:06, Rowan Tommins wrote: > On 2 December 2020 22:38:13 GMT+00:00, "Björn Larsson" > wrote: > >> One could add that here the PHP programmer need to do work that >> basically >> replicate how the code worked earlier for little gain. > > Just to reiterate, the previous implement

Re: [PHP-DEV] Re: PHP 8 is_file/is_dir input handling

2020-12-02 Thread Rowan Tommins
On 2 December 2020 22:38:13 GMT+00:00, "Björn Larsson" wrote: >One could add that here the PHP programmer need to do work that >basically >replicate how the code worked earlier for little gain. Just to reiterate, the previous implementation was also bad - it returned an entirely undocumented a

Re: [PHP-DEV] Re: PHP 8 is_file/is_dir input handling

2020-12-02 Thread Björn Larsson
Den 2020-12-01 kl. 20:57, skrev Stanislav Malyshev: Hi! Is a warning fine because null bytes indicate a potential attack as in no sane context should null bytes be passed around? A warning is fine because it does what it's supposed to do - fails the is_file check (which is literally only t

Re: [PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread Christian Schneider
Am 02.12.2020 um 18:24 schrieb Florian Stascheck : > I suggest to allow string keys to also be used in array literals: > > $template = ['created_at' => time(), 'is_admin' => 1]; > $db_rows = [ > ['name' => 'Alice', 'email' => 'al...@example.org', ...$template], > ['name' => 'Bob', 'email' => 'b.

Re: [PHP-DEV] PHP 8 is_file/is_dir input handling

2020-12-02 Thread Larry Garfield
On Wed, Dec 2, 2020, at 2:18 AM, Christian Schneider wrote: > Am 01.12.2020 um 21:13 schrieb Reindl Harald (privat) : > > Am 01.12.20 um 21:09 schrieb Stanislav Malyshev: > >>> we are running error_reporting E_ALL for 17 years now and don't > >>> distinct between notice / warning / error, it has to

[PHP-DEV] R: [PHP-DEV] [RFC] Deprecate passing null to non-nullable argumentsof internal functions

2020-12-02 Thread Silvio Sparapano
Hello, IMHO it’s only a declaration issue. In other terms, if documentation of strlen says: strlen ( string $string ) : int then I mean that $string MUST be a string, and return value MUST be an int. But then we found that if $string is null, zero is returned. If $string is an array, null is

[PHP-DEV] Allow new Cl()->method()

2020-12-02 Thread Michael Voříšek - ČVUT FEL
Hi devs, currently new Cl() must be wrapped in parentheses if that object is further used to call it's method like (new Cl())->method(). It there any reason why not to allow new Cl()->method() ? Based on https://www.php.net/manual/en/language.operators.precedence.php - the "new" operator ha

Re: [PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread Josh Bruce
> > The reason why this has been deferred is because of which semantics should > be used for duplicate string keys. > > Do we use the addition between two arrays semantics or the array_merge() > semantics? See: https://3v4l.org/7QbWv > > As the previous RFC you linked initially wanted to use the

Re: [PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread Chuck Adams
On Wed, Dec 2, 2020 at 10:46 AM G. P. B. wrote: > The reason why this has been deferred is because of which semantics should > be used for duplicate string keys. > > Do we use the addition between two arrays semantics or the array_merge() > semantics? See: https://3v4l.org/7QbWv array_merge is th

Re: [PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread G. P. B.
On Wed, 2 Dec 2020 at 17:24, Florian Stascheck wrote: > Hello! > > With PHP8 released and the named arguments RFC being implemented, there's > now an inconsistency in how the spread operator works. > > Historically, the spread operator was first used in PHP 5.6 for arguments: > > function php56($

[PHP-DEV] Suggestion: Inconsistency: Allow array spread operator to work on string keys

2020-12-02 Thread Florian Stascheck
Hello! With PHP8 released and the named arguments RFC being implemented, there's now an inconsistency in how the spread operator works. Historically, the spread operator was first used in PHP 5.6 for arguments: function php56($a, $b) { return $a + $b; } $test = [1, 2]; php56(...$test) === 3;

[PHP-DEV] Pass file handle in XMLReader

2020-12-02 Thread Aimeos | Norbert Sendetzky
Hi internals The XMLReader object only allows a file name in the constructor and the open() method. While this is OK most of the time, files stored at cloud services not accessible via an URL must be downloaded first. For big files (e.g 100MB to 1GB and more), this requires a lot of time and resou

[PHP-DEV] Re: R: [PHP-DEV] [RFC] Deprecate passing null to non-nullableargumentsof internal functions

2020-12-02 Thread Christoph M. Becker
On 02.12.2020 at 17:34, Silvio Sparapano wrote: > Hello, > IMHO it’s only a declaration issue. > > In other terms, if documentation of strlen says: > > strlen ( string $string ) : int > > then I mean that $string MUST be a string, and return value MUST be an int. > > But then we found that if $str

Re: [PHP-DEV] erorr_reporting() and @ operator

2020-12-02 Thread Nikita Popov
On Wed, Dec 2, 2020 at 3:14 PM Benjamin Morel wrote: > Thanks for the pointer, Nikita. > > I think the updated example (using `error_reporting() & $errno`) fails to > mimic exactly what `error_reporting() === 0` did, though. > > Say your php.ini mutes E_WARNING, for example: > > error_reporti

Re: [PHP-DEV] erorr_reporting() and @ operator

2020-12-02 Thread Benjamin Morel
Thanks for the pointer, Nikita. I think the updated example (using `error_reporting() & $errno`) fails to mimic exactly what `error_reporting() === 0` did, though. Say your php.ini mutes E_WARNING, for example: error_reporting = E_ALL & ~E_WARNING Checking for `error_reporting() === 0` allo

Re: [PHP-DEV] erorr_reporting() and @ operator

2020-12-02 Thread Nikita Popov
On Wed, Dec 2, 2020 at 2:56 PM Benjamin Morel wrote: > Hi internals, > > Since PHP 8.0, `error_reporting()` started returning a non-zero value when > the @ silence operator is used. > > Demo: https://3v4l.org/CovYv > > Is this intentional? This breaks scripts that converted all errors to > except

[PHP-DEV] erorr_reporting() and @ operator

2020-12-02 Thread Benjamin Morel
Hi internals, Since PHP 8.0, `error_reporting()` started returning a non-zero value when the @ silence operator is used. Demo: https://3v4l.org/CovYv Is this intentional? This breaks scripts that converted all errors to exceptions, except those where the silence operator was used: set_error

Re: [PHP-DEV] Re: PHP 8 is_file/is_dir and imagecreatefromstring()

2020-12-02 Thread Christoph M. Becker
On 02.12.2020 at 13:21, Hans Henrik Bergan wrote: > so.. will the imagecreatefromstring() thing be fixed in 8.0.1 or 8.1.0 ? This will be fixed in 8.0.1. Christoph -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: https://www.php.net/unsub.php

Re: [PHP-DEV] Re: PHP 8 is_file/is_dir and imagecreatefromstring()

2020-12-02 Thread Hans Henrik Bergan
so.. will the imagecreatefromstring() thing be fixed in 8.0.1 or 8.1.0 ? On Wed, 2 Dec 2020 at 10:57, Nikita Popov wrote: > > On Wed, Dec 2, 2020 at 10:21 AM Aimeos | Norbert Sendetzky < > norb...@aimeos.com> wrote: > > > Am 01.12.20 um 18:24 schrieb Christoph M. Becker: > > > On 01.12.2020 at 18

Re: [PHP-DEV] Re: PHP 8 is_file/is_dir and imagecreatefromstring()

2020-12-02 Thread Nikita Popov
On Wed, Dec 2, 2020 at 10:21 AM Aimeos | Norbert Sendetzky < norb...@aimeos.com> wrote: > Am 01.12.20 um 18:24 schrieb Christoph M. Becker: > > On 01.12.2020 at 18:18, Aimeos | Norbert Sendetzky wrote: > > > >> PHP 8 is stricter in checking input data then PHP 7. This is good but > >> has some sid

[PHP-DEV] Re: PHP 8 is_file/is_dir and imagecreatefromstring()

2020-12-02 Thread Aimeos | Norbert Sendetzky
Am 01.12.20 um 18:24 schrieb Christoph M. Becker: > On 01.12.2020 at 18:18, Aimeos | Norbert Sendetzky wrote: > >> PHP 8 is stricter in checking input data then PHP 7. This is good but >> has some side effects for is_file(), is_dir() and similar functions when >> invalid paths are passed for check

Re: [PHP-DEV] PHP 8 is_file/is_dir input handling

2020-12-02 Thread Reindl Harald (privat)
Am 02.12.20 um 09:18 schrieb Christian Schneider: Am 01.12.2020 um 21:13 schrieb Reindl Harald (privat) : Am 01.12.20 um 21:09 schrieb Stanislav Malyshev: we are running error_reporting E_ALL for 17 years now and don't distinct between notice / warning / error, it has to be fixed - period S

Re: [PHP-DEV] PHP 8 is_file/is_dir input handling

2020-12-02 Thread Christian Schneider
Am 01.12.2020 um 21:13 schrieb Reindl Harald (privat) : > Am 01.12.20 um 21:09 schrieb Stanislav Malyshev: >>> we are running error_reporting E_ALL for 17 years now and don't >>> distinct between notice / warning / error, it has to be fixed - >>> period >> Surely you do. Your code continues to run