Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Kamil Tekiela
Your opinion is highly appreciated, Johannes. I feel that we will have to implement this change as you are proposing. I don't think I am rushing this change, because I believe is already late. It should have been fixed in PHP 7 or PHP 8, but because very little people use mysqli this extension hasn

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Johannes Schlüter
On February 27, 2021 7:29:43 PM GMT+01:00, Kamil Tekiela wrote: >> The code shown here >https://www.w3schools.com/php/func_mysqli_connect.asp is >relatively correct at the moment. Maybe not nice, but it handles the >error. >That is the second hit on google (after php.net manual) when searching

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread Nikita Popov
On Sat, Feb 27, 2021 at 10:12 PM Rowan Tommins wrote: > On 27/02/2021 20:05, Nikita Popov wrote: > > If we additionally change it to explicitly print reference wrappers, I > > believe that debug_zval_dump() will produce a faithful representation. > > > Is that even possible without either accepti

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread Rowan Tommins
On 27/02/2021 20:05, Nikita Popov wrote: If we additionally change it to explicitly print reference wrappers, I believe that debug_zval_dump() will produce a faithful representation. Is that even possible without either accepting parameters by reference, or taking a variable name like the XDe

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Benjamin Eberlei
On Sat, Feb 27, 2021 at 5:24 PM Kamil Tekiela wrote: > > > > The issue is, as said, that this only happens in an error situation. > > Thus if users only test "does my site still work after update?" (what > > many do ...) won't notice this, till something fails, which would have > > been caught ni

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread Rowan Tommins
On 27/02/2021 19:29, tyson andre wrote: - Checking the difference between two runs is useful in a bug report - if counts increase or decrease after calling a function that isn't supposed to modify reference counts, this makes it an obvious indicator for reference counting bugs that can be su

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread Nikita Popov
On Sat, Feb 27, 2021 at 3:00 PM Rowan Tommins wrote: > Hi all, > > I would like to propose we formally deprecate the function debug_zval_dump > and remove it in PHP 9.0. > > This function is mostly similar to var_dump, with the additional ability > to output the refcount of a variable. This has a

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Kamil Tekiela
Hi Matthew, As was pointed out before ZEROFILL is getting deprecated. It has been deprecated by MySQL and I assume MariaDB will follow soon. The change you are referring to is only to fix inconsistency in PHP. The problem with ZEROFILL has been present since forever as far as I know. The setting

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread tyson andre
Hi Rowan Tommins, > I would like to propose we formally deprecate the function debug_zval_dump > and remove it in PHP 9.0. > > This function is mostly similar to var_dump, with the additional ability to > output the refcount of a variable. This has always been hard to interpret, > but is now s

Re: [PHP-DEV] [RFC] mysqli bind in execute

2021-02-27 Thread Kamil Tekiela
On Thu, 25 Feb 2021 at 08:35, Claude Pache wrote: > > Hi, > > In the paragraph “Difference between PDO and mysqli”, you propose: > > “Array keys are completely ignored. mysqli doesn't have emulated prepares > nor does it have named parameters.” > > Instead of ignoring the keys, I think it is bett

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Rowan Tommins
On 27/02/2021 18:10, Kamil Tekiela wrote: Select * From products Where product_id = 'hello world' If product_id is a column of type int, then the database will raise an error about incompatible types. No, this query would produce a warning. I am unaware of an SQL mode that would

Re: [PHP-DEV] Support JSON With Commas and Comments (JWCC) in json_decode

2021-02-27 Thread Craig Francis
On Tue, 23 Feb 2021 at 18:46, Rowan Tommins wrote: > On 23/02/2021 18:21, Pavel Djundik via internals wrote: > > See https://nigeltao.github.io/blog/2021/json-with-commas-comments.html > > for more information. > > ... > > Perhaps this could be disabled by default and made opt-in with a > > optio

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Kamil Tekiela
> The code shown here https://www.w3schools.com/php/func_mysqli_connect.asp is relatively correct at the moment. Maybe not nice, but it handles the error. That is the second hit on google (after php.net manual) when searching for "php tutorial mysqli_conect") Most other books, tutorials, ... teach

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Kamil Tekiela
> > Select * From products Where product_id = 'hello world' > > If product_id is a column of type int, then the database will raise an > error about incompatible types. > No, this query would produce a warning. I am unaware of an SQL mode that would turn this warning into an error. Maybe I am wron

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Rowan Tommins
On 27/02/2021 16:57, Kamil Tekiela wrote: If product_id is actually an integer column, this function is technically broken: given a non-integer input, it will produce an error in the database. I'm sorry, but I do not understand why would that code produce an error. The value i

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Johannes Schlüter
On February 27, 2021 5:23:47 PM GMT+01:00, Kamil Tekiela wrote: >> >> The issue is, as said, that this only happens in an error situation. >> Thus if users only test "does my site still work after update?" (what >> many do ...) won't notice this, till something fails, which would >have >> been

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Kamil Tekiela
> > If product_id is actually an integer column, this function is > technically broken: given a non-integer input, it will produce an error > in the database. > I'm sorry, but I do not understand why would that code produce an error. The value is properly escaped and formatted so there should be n

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Rowan Tommins
On 27/02/2021 16:23, Kamil Tekiela wrote: I don't see why this would be such an issue. If the code fails for any reason then an error is produced. The error might be surprising, but it is not something that would cause problems. Just addressing this argument, not the proposal itself, a functio

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Rowan Tommins
On 27/02/2021 15:51, Pierre wrote: Yes, but PDOStatement::execute() explicitly documents that it can be used only for prepared queries. The same is true of bindParam and bindValue - the only way of using parameters is to first "prepare" a query. Whether that's a real prepare (on the database

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Kamil Tekiela
> > The issue is, as said, that this only happens in an error situation. > Thus if users only test "does my site still work after update?" (what > many do ...) won't notice this, till something fails, which would have > been caught nice beforehand. > I don't see why this would be such an issue. If

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Pierre
Le 27/02/2021 à 15:39, Rowan Tommins a écrit : On 27/02/2021 14:03, Pierre wrote: I'm curious, why are you stating that emulated prepares are not useful anymore ? Emulated prepares are a slightly dangerous idea, because they give the impression of separating query from data, but actually use st

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Nikita Popov
On Sat, Feb 27, 2021 at 9:50 AM Matty The Mad wrote: > PHP 8.1 PDO has been changed so that when MySQL returns an integer it > will no longer be returned as a string, but as an int. > > The problem is this breaks any sites that use UNSIGNED ZEROFILL integer > fields in MySQL. > > I support a numb

Re: [PHP-DEV] [RFC]: Change Default mysqli Error Mode

2021-02-27 Thread Johannes Schlüter
On Wed, 2021-01-27 at 15:17 +0100, Sebastian Bergmann wrote: > Am 25.01.2021 um 11:03 schrieb Nikita Popov: > > Fully support this proposal. Throwing exceptions is the right > > default, it > > matches what PDO does, and restoring the old behavior is one line > > of code. > > I second that emotion

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Rowan Tommins
On 27/02/2021 14:03, Pierre wrote: I'm curious, why are you stating that emulated prepares are not useful anymore ? Emulated prepares are a slightly dangerous idea, because they give the impression of separating query from data, but actually use string escaping internally. Historically, I be

Re: [PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread G. P. B.
On Sat, 27 Feb 2021 at 14:00, Rowan Tommins wrote: > Hi all, > > I would like to propose we formally deprecate the function debug_zval_dump > and remove it in PHP 9.0. > > This function is mostly similar to var_dump, with the additional ability > to output the refcount of a variable. This has alw

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Pierre
Le 27/02/2021 à 14:18, David Gebler a écrit : Apologies, in respect of point 1 in my reply, I misread your original message and didn't realise you were referring to the upcoming 8.1 change, thought you were referring to the current 8.0.1 release. This change AFAIK only affects emulated prepares

[PHP-DEV] Deprecate debug_zval_dump?

2021-02-27 Thread Rowan Tommins
Hi all, I would like to propose we formally deprecate the function debug_zval_dump and remove it in PHP 9.0. This function is mostly similar to var_dump, with the additional ability to output the refcount of a variable. This has always been hard to interpret, but is now so complex as to be eff

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread David Gebler
Apologies, in respect of point 1 in my reply, I misread your original message and didn't realise you were referring to the upcoming 8.1 change, thought you were referring to the current 8.0.1 release. This change AFAIK only affects emulated prepares and is an improvement, as previously you needed

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Stephen Reay
> On 27 Feb 2021, at 15:56, Matty The Mad wrote: > > PHP 8.1 PDO has been changed so that when MySQL returns an integer it will > no longer be returned as a string, but as an int. > > The problem is this breaks any sites that use UNSIGNED ZEROFILL integer > fields in MySQL. > > I support a

Re: [PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread David Gebler
Hi Matthew, 1. PHP 8 has not introduced a change to PDO_MYSQL in respect of how values are fetched. What makes the difference as to whether you get MySQL INT values fetched as strings or integers is whether you are running PHP with the mysqlnd https://dev.mysql.com/downloads/connector/php-mysqlnd/

[PHP-DEV] PDO integer changes in 8.1 will stop many websites I support

2021-02-27 Thread Matty The Mad
PHP 8.1 PDO has been changed so that when MySQL returns an integer it will no longer be returned as a string, but as an int. The problem is this breaks any sites that use UNSIGNED ZEROFILL integer fields in MySQL. I support a number of websites where the phone numbers and post codes are all