svn: /web/qa/trunk/reports/ parserfunc.php
| From: | Johannes Schlüter | Date: | Fri, 24 Jun 2011 19:56:46 +0000 |
| Subject: | svn: /web/qa/trunk/reports/ parserfunc.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-65843@lists.php.net to get a copy of this message | ||
johannes Fri, 24 Jun 2011 19:56:46 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=312444
Log:
Improve escaping
Changed paths:
U web/qa/trunk/reports/parserfunc.php
Modified: web/qa/trunk/reports/parserfunc.php
===================================================================
--- web/qa/trunk/reports/parserfunc.php 2011-06-24 19:35:30 UTC (rev 312443)
+++ web/qa/trunk/reports/parserfunc.php 2011-06-24 19:56:46 UTC (rev 312444)
@@ -22,11 +22,6 @@
// impossible to fetch data. We'll record this error later ...
} else {
- if ($array['userEmail'] == null)
- $array['userEmail'] = 'NULL';
- else
- $array['userEmail'] =
"'".addslashes($array['userEmail'])."'";
-
if (strtolower($array['status']) == 'failed')
$array['status'] = 0;
@@ -81,13 +76,13 @@
$query = "INSERT INTO
reports (id, date,
status,
nb_failed, nb_expected_fail, build_env,
phpinfo, user_email) VALUES (null,
datetime(".((int) $array['date']).", 'unixepoch',
'localtime'),
- '".addslashes($array['status'])."',
- '".count($array['failedTest'])."',
- '".count($array['expectedFailedTest'])."',
+ ".((int)$array['status']).",
+ ".count($array['failedTest']).",
+ ".count($array['expectedFailedTest']).",
('".$dbi->escapeString($array['buildEnvironment'])."'),
- ('".$dbi->escapeString($array['phpinfo'])."'),
".$array['userEmail']."
+ ('".$dbi->escapeString($array['phpinfo'])."'),
+ ".(!$array['userEmail'] ? "NULL" :
"'".$dbi->escapeString($array['userEmail'])."'")."
)";
- // userEmail is already escaped on line 28
$dbi->query($query);
if ($dbi->lastErrorCode() != '') {