Doc #74190 [Opn->Nab]: mysqli_num_rows return value on error

From: Date: Wed, 01 Mar 2017 13:46:52 +0000
Subject: Doc #74190 [Opn->Nab]: mysqli_num_rows return value on error
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-14471@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74190&edit=1 ID: 74190 Updated by: requinix@php.net Reported by: phpdoc at mail dot my1 dot info Summary: mysqli_num_rows return value on error -Status: Open +Status: Not a bug Type: Documentation Problem -Package: Documentation problem +Package: MySQLi related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: mysqli_num_rows() always returns an int so there is no error value in that sense. Built-in functions normally return NULL when given invalid arguments. It is documented in the functions reference: http://php.net/manual/en/functions.internal.php Previous Comments: ------------------------------------------------------------------------ [2017-03-01 10:29:13] phpdoc at mail dot my1 dot info Description: ------------ --- From manual page: http://www.php.net/mysqli-result.num-rows --- it doesnt say what gets returned on error (for comparison mysql_num_rows, according to the docs throws false). by thorwing in a value that cant work (for example a string), it returned NULL and a warning. since both NULL and 0 are variables that are false-y and according to http://php.net/manual/de/types.comparisons.php#types.comparisions-loose both (NULL == 0) and (NULL == 0) evaluate to true there should be a warning box, noting that strict comparison using === should be appropriate, similar to http://php.net/manual/de/function.strpos.php Test script: --------------- <?php var_dump(mysqli_num_rows("abc")); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74190&edit=1

« previous php.doc.bugs (#14471) next »