$sql_аry
vs $sql_ary
. What's the difference between these two strings? The first one has a russian lowercase а for some odd reason, and only that letter. I don't know why or how that happened.This can be closed
------------------------------------
(yes I added $phpbb_dispatcher to the global vars at the top of the function to get events to work, thanks Marc in the discord for that...)
So I made an event (no pr yet) in functions_admin.php, in the sync function, forums case:
Code: Select all
$sql_аry = array(
'SELECT' => 'p.post_id, p.poster_id, p.post_subject, p.post_time, p.post_username, u.username, u.user_colour',
'FROM' => array(
POSTS_TABLE => 'p',
USERS_TABLE => 'u',
),
'WHERE' => $db->sql_in_set('p.post_id', $post_ids) . '
AND p.poster_id = u.user_id',
);
/**
* Event to modify the SQL array to get the post and user data from all forums' last posts
*
* @event core.sync_forum_last_post_info_sql
* @var array sql_аry SQL array with some post and user data from the last posts list
* @since 3.2.6-RC1
*/
$vars = array('sql_аry');
extract($phpbb_dispatcher->trigger_event('core.sync_forum_last_post_info_sql', compact($vars)));
$result = $db->sql_query($db->sql_build_query('SELECT', $sql_аry));
$sql = $db->sql_build_query('SELECT', $sql_аry)
before the actual sql_query, but whatever.Now, I did the same exact thing (no pr yet) in functions_posting.php right after the query, just like before:
Code: Select all
$sql_ary = array(
'SELECT' => 'p.' . $type . '_id, p.post_id, p.post_subject, p.post_time, p.poster_id, p.post_username, u.user_id, u.username, u.user_colour',
'FROM' => array(
POSTS_TABLE => 'p',
USERS_TABLE => 'u',
),
'WHERE' => $db->sql_in_set('p.post_id', $last_post_ids) . '
AND p.poster_id = u.user_id',
);
/**
* Event to modify the SQL array to get the post and user data from all last posts
*
* @event core.update_post_info_modify_posts_sql
* @var string type The table being updated (forum or topic)
* @var array sql_ary SQL array to get some of the last posts' data
* @since 3.2.6-RC1
*/
$vars = array(
'type',
'sql_ary',
);
extract($phpbb_dispatcher->trigger_event('core.update_post_info_modify_posts_sql', compact($vars)));
$sql = $db->sql_build_query('SELECT', $sql_аry);
$result = $db->sql_query($sql);
and I get this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM ()' at line 1 [1064]
aand
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/db/driver/driver.php on line 716: Invalid argument supplied for foreach()
So, I decided to do var_dump/print_r on the sql_build_query and I got:
SELECT FROM()
a completely blank query....
even more fun, if I try to do var_dump/print_r on the
$sql_ary
var itself, it's null. Hell I even copied code from another function that uses sql_build_query for a select query and it also messes up.Wtf?