TinyPortal

Development => Feedback => Bugs/Errors => Topic started by: siath on June 23, 2011, 07:13:59 AM

Title: Bug Found And Corrected
Post by: siath on June 23, 2011, 07:13:59 AM
Wrong value type sent to the database. Integer expected. (page)

I was getting this bug on a intall of the latest TP (TP1 RC2).

See, some of my members and some of my code called pages by their name.

Any who, I did a bit of looking and discovered an error in the code.

function TP_loadTheme()
{
   global $db_prefix, $context, $scripturl, $txt, $user_info, $settings;
   global $modSettings, $boardurl, $sourcedir, $smcFunc;

   require_once($sourcedir.'/TPSubs.php');

   $theme = 0;

   // are we on a article? check it for custom theme
    if(isset($_GET['page']) && !isset($_GET['action']))
   {
      // fetch the custom theme if any
      $pag = tp_sanitize($_GET['page']);
      if(is_numeric($pag))
         $request = $smcFunc['db_query']('', '
            SELECT id_theme FROM {db_prefix}tp_articles
            WHERE id = {int:page}',
            array('page' => $pag)
         );
      else
         $request =  $smcFunc['db_query']('', '
            SELECT id_theme FROM {db_prefix}tp_articles
            WHERE shortname = {int:page}',
            array('page' => $pag)
         );

      if($smcFunc['db_num_rows']($request) > 0)
      {

WHERE shortname = {int:page}',

Should be
            WHERE shortname = {string:page}',

It fixed my problem rather quickly. ;)

Anyway, nice job guys keep up the good work.

P.S. Did you know if I put a code box in the page it tells me I can't post external links? Yet, you ask for a code box with information in it... That just doesn't make sense to me.
Title: Re: Bug Found And Corrected
Post by: IchBin on June 23, 2011, 08:37:49 AM
Yes, I've already added this into the code for the next release. Thank you.
Title: Re: Bug Found And Corrected
Post by: ZarPrime on June 23, 2011, 08:53:42 AM
P.S. Did you know if I put a code box in the page it tells me I can't post external links? Yet, you ask for a code box with information in it... That just doesn't make sense to me.

And on this, not being able to use the bbc code tags in your posts may be an unintended side effect of a Mod that we are using here.  Sorry about that.  I am looking into it.  Thank you for letting us know.

ZarPrime