From 043b6a207a563e135296550270bd296292926f3d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 28 Mar 2014 21:48:29 +0100 Subject: [PATCH 1/3] [ticket/12317] Do not repeat SQL query in notification_submit_post_base. PHPBB3-12317 --- tests/notification/submit_post_base.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/tests/notification/submit_post_base.php b/tests/notification/submit_post_base.php index fb8e2ac807..10d676c687 100644 --- a/tests/notification/submit_post_base.php +++ b/tests/notification/submit_post_base.php @@ -133,7 +133,7 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt WHERE nt.notification_type_name = '" . $this->item_type . "' AND n.notification_type_id = nt.notification_type_id - ORDER BY user_id, item_id ASC"; + ORDER BY user_id ASC, item_id ASC"; $result = $this->db->sql_query($sql); $this->assertEquals($expected_before, $this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result); @@ -142,11 +142,6 @@ abstract class phpbb_notification_submit_post_base extends phpbb_database_test_c $post_data = array_merge($this->post_data, $additional_post_data); submit_post('reply', '', 'poster-name', POST_NORMAL, $poll_data, $post_data, false, false); - $sql = 'SELECT user_id, item_id, item_parent_id - FROM ' . NOTIFICATIONS_TABLE . ' n, ' . NOTIFICATION_TYPES_TABLE . " nt - WHERE nt.notification_type_name = '" . $this->item_type . "' - AND n.notification_type_id = nt.notification_type_id - ORDER BY user_id ASC, item_id ASC"; $result = $this->db->sql_query($sql); $this->assertEquals($expected_after, $this->db->sql_fetchrowset($result)); $this->db->sql_freeresult($result); From c4892448950aa7eb1bba5bd4506a747eee2631f2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 28 Mar 2014 21:59:42 +0100 Subject: [PATCH 2/3] [ticket/12317] Fix notification tests for DBMSes returning integers as int. PHPBB3-12317 --- tests/notification/submit_post_type_bookmark_test.php | 2 +- tests/notification/submit_post_type_post_test.php | 2 +- tests/notification/submit_post_type_quote_test.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/notification/submit_post_type_bookmark_test.php b/tests/notification/submit_post_type_bookmark_test.php index 861017ff5f..4e4a3f6c9a 100644 --- a/tests/notification/submit_post_type_bookmark_test.php +++ b/tests/notification/submit_post_type_bookmark_test.php @@ -27,7 +27,7 @@ class phpbb_notification_submit_post_type_bookmark_test extends phpbb_notificati $this->greaterThan(0)) ->will($this->returnValueMap(array( array( - array('3', '4', '5', '6', '7'), + array(3, 4, 5, 6, 7), 'f_read', 1, array( diff --git a/tests/notification/submit_post_type_post_test.php b/tests/notification/submit_post_type_post_test.php index 473247a764..c2eb419522 100644 --- a/tests/notification/submit_post_type_post_test.php +++ b/tests/notification/submit_post_type_post_test.php @@ -27,7 +27,7 @@ class phpbb_notification_submit_post_type_post_test extends phpbb_notification_s $this->greaterThan(0)) ->will($this->returnValueMap(array( array( - array('3', '4', '5', '6', '7', '8'), + array(3, 4, 5, 6, 7, 8), 'f_read', 1, array( diff --git a/tests/notification/submit_post_type_quote_test.php b/tests/notification/submit_post_type_quote_test.php index 2b66d9c6a1..a849cb7b1b 100644 --- a/tests/notification/submit_post_type_quote_test.php +++ b/tests/notification/submit_post_type_quote_test.php @@ -27,7 +27,7 @@ class phpbb_notification_submit_post_type_quote_test extends phpbb_notification_ $this->greaterThan(0)) ->will($this->returnValueMap(array( array( - array('3', '4', '5', '6', '7'), + array(3, 4, 5, 6, 7), 'f_read', 1, array( From ad2ed01623daeea6abdf24b3f6710cbc10dcad9c Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 28 Mar 2014 22:14:01 +0100 Subject: [PATCH 3/3] [ticket/12317] Cast string to int to refix DBMSes not using int for integers. PHPBB3-12317 --- phpBB/phpbb/notification/type/bookmark.php | 2 +- phpBB/phpbb/notification/type/post.php | 4 ++-- phpBB/phpbb/notification/type/quote.php | 2 +- phpBB/phpbb/notification/type/topic.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/phpBB/phpbb/notification/type/bookmark.php b/phpBB/phpbb/notification/type/bookmark.php index 5e6fdd2523..003998677d 100644 --- a/phpBB/phpbb/notification/type/bookmark.php +++ b/phpBB/phpbb/notification/type/bookmark.php @@ -75,7 +75,7 @@ class bookmark extends \phpbb\notification\type\post $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index bc42c4422b..b2ad8ff33d 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -103,7 +103,7 @@ class post extends \phpbb\notification\type\base $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); @@ -115,7 +115,7 @@ class post extends \phpbb\notification\type\base $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/notification/type/quote.php b/phpBB/phpbb/notification/type/quote.php index e8527261d8..745430e114 100644 --- a/phpBB/phpbb/notification/type/quote.php +++ b/phpBB/phpbb/notification/type/quote.php @@ -94,7 +94,7 @@ class quote extends \phpbb\notification\type\post $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result); diff --git a/phpBB/phpbb/notification/type/topic.php b/phpBB/phpbb/notification/type/topic.php index 98f086a50b..635d05bccd 100644 --- a/phpBB/phpbb/notification/type/topic.php +++ b/phpBB/phpbb/notification/type/topic.php @@ -103,7 +103,7 @@ class topic extends \phpbb\notification\type\base $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { - $users[] = $row['user_id']; + $users[] = (int) $row['user_id']; } $this->db->sql_freeresult($result);