On Wed, 30 Dec 2020 at 18:33, Kamil Tekiela <tekiela...@gmail.com> wrote:
> [...] I have written an RFC which explains all my ideas. > https://wiki.php.net/rfc/improve_mysqli Hi Kamil, As there is a discussion about MySQLi raising exceptions, and you're looking at the general mysqli API... When using mysqli_stmt::bind_param(), it won't raise an exception when the number of variables doesn't match the number of parameters, instead it's a Fatal Error: $statement = $db->prepare('SELECT * FROM user WHERE id = ?'); $statement->bind_param('ii', $id, $id); So database abstractions need to do messy things like: if (count($ref_values) != $statement->param_count) { throw new mysqli_sql_exception('Invalid parameter count', 2034); } else { array_unshift($ref_values, $ref_types); call_user_func_array([$statement, 'bind_param'], $ref_values); } Should mysqli_stmt::bind_param() be updated to raise an exception instead? Or, because it's such a broken function (e.g. passing variables by reference, and the annoying $types string), should we just forget about it, and focus on getting mysqli_stmt::execute() to accept an array of parameters? Craig On Wed, 30 Dec 2020 at 18:33, Kamil Tekiela <tekiela...@gmail.com> wrote: > Hi Internals, > > I would like to start a discussion about possible improvements to the > mysqli API. I have written an RFC which explains all my ideas. > > https://wiki.php.net/rfc/improve_mysqli > > As the RFC is nothing more than a concept at the moment I am looking > for some feedback. I attempted to implement some of the changes myself > but due to my limited experience with C and PHP internals I didn't get > far. I would appreciate if some volunteer would like to help me to > implement the changes once they are ironed out. > > I understand that the RFC will need to be split up before voting. > > Kind regards, > Kamil Tekiela > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > >