Bug #76968 [Fbk->NoF]: error_log does not nt show correct ouput

From: Date: Sun, 18 Nov 2018 22:38:42 +0000
Subject: Bug #76968 [Fbk->NoF]: error_log does not nt show correct ouput
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218024@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76968&edit=1 ID: 76968 Updated by: cmb@php.net Reported by: forum at sodcore dot com Summary: error_log does not nt show correct ouput -Status: Feedback +Status: No Feedback Type: Bug Package: *General Issues Operating System: Debian PHP Version: 7.0.32 Block user comment: N Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2018-10-04 12:16:37] kalle@php.net It depends on what your prepare_sql() function would return, if it does any escaping or such, then it could be the reasoning for this behavior. Try var_dump($sqlStatement); before calling error_log() and see what it yields. Seems more like an issue in your code, than a bug in error_log() itself ------------------------------------------------------------------------ [2018-10-04 12:13:56] sjon at hortensius dot net I cannot reproduce this. Do you have the same problem when you simply log the string directly? Maybe prepare_sql performs magic on it? ------------------------------------------------------------------------ [2018-10-04 05:38:56] forum at sodcore dot com Description: ------------ When error_log is run it addes extra lines to a variable like #12#11#11 Yet code runs correctly. Test script: --------------- <?php require "../standard/functions.php"; $d = ""; $temp = "data;"; // Check to make sure we have correct request method post and that the token key fits if ($_SERVER ["REQUEST_METHOD"] == "POST" && ! empty ( $_POST ["T"] ) && $_POST ["T"] == $TOKEN_LOCK_HTTP_POST) { if (!empty($_POST["d"])) { $d = $_POST["d"]; } // define variables and set to empty values $con = get_database_connection (); // If there is a result echo the results $sqlStatment = prepare_sql("select * from table,table2 WHERE table.id = table2.id and table2.serial = '$d';"); error_log($sqlStatment,0); if ($res = $con->query($sqlStatment)) { $res->data_seek(0); $totalRows = $res->num_rows; // Return the total number of rows if ($totalRows > 0) { while ($row = $res->fetch_assoc()) { $temp .= $row['f']; } } $res->close(); } else { $temp .= "-100"; } echo $temp; } ?> Expected result: ---------------- I expect error_log to log: select * from table,table2 WHERE table.id = table2.id and table2.serial = '$d'; But it logs: select * from table,table2 WHERE table#12#11#11.id = table2.id and table2.serial = '$d'; Yet the code works correctly. The logging is messed up in more then one of my files. Actual result: -------------- But it logs: select * from table,table2 WHERE table#12#11#11.id = table2.id and table2.serial = '$d'; ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76968&edit=1

« previous php.bugs (#218024) next »