Bug #75410 [NEW]: mysqli_stmt_bind_param does not generate warnings/errors for undefined vars

From: Date: Fri, 20 Oct 2017 17:07:08 +0000
Subject: Bug #75410 [NEW]: mysqli_stmt_bind_param does not generate warnings/errors for undefined vars
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211792@lists.php.net to get a copy of this message
From: nisto at gmx dot com Operating system: Windows 7 PHP version: 7.1.10 Package: MySQLi related Bug Type: Bug Bug description:mysqli_stmt_bind_param does not generate warnings/errors for undefined vars Description: ------------ I was trying to debug a database error and after many minutes eventually realized that I had misspelled a variable passed to mysqli_stmt_bind_param (which, of course, was not set). I think it should really throw an error, or at least give a warning if a variable is undefined. I downloaded PHP from windows.php.net. I have error_reporting set to E_ALL and display_errors is enabled. My php.ini file looks essentially just like the included php.ini-development file; the only difference is that I've enabled the mysqli and mbstring extensions. Test script: --------------- <?php $Db = mysqli_connect('host', 'user', 'pass', 'database'); $Query = "SELECT field1 FROM table WHERE field2 = ? LIMIT 1"; $Statement = mysqli_stmt_init($Db); mysqli_stmt_prepare($Stmt, $Query); /* I would expect this to throw a warning or error */ mysqli_stmt_bind_param($Stmt, 's', $UndefinedVariable); ?> Expected result: ---------------- A warning or error. Actual result: -------------- No warning or error is given. -- Edit bug report at https://bugs.php.net/bug.php?id=75410&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75410&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75410&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75410&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=75410&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=75410&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=75410&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=75410&r=needscript Try newer version: https://bugs.php.net/fix.php?id=75410&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=75410&r=support Expected behavior: https://bugs.php.net/fix.php?id=75410&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=75410&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=75410&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=75410&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75410&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=75410&r=dst IIS Stability: https://bugs.php.net/fix.php?id=75410&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=75410&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=75410&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=75410&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=75410&r=mysqlcfg

« previous php.bugs (#211792) next »