• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Fixed Number of variables doesn't match number of parameters in prepared statement

Romchik®

Well-known member
#1
2 computers and 2 installed copies of the XF on the localhost for testing.

Yesterday I updated the first copy at home with beta 3. Then I updated a couple of styles. I exported the XML files and take them to work.

At work, I also updated the forum with beta 3. I'm trying to import styles and get an error.
Server Error

mysqli_stmt::bind_param() [mysqli-stmt.bind-param]: Number of variables doesn't match number of parameters in prepared statement
  1. XenForo_Application::handlePhpError()
  2. mysqli_stmt->bind_param()
  3. call_user_func_array() in ***\xf\library\Zend\Db\Statement\Mysqli.php at line 204
  4. Zend_Db_Statement_Mysqli->_execute() in ***\xf\library\Zend\Db\Statement.php at line 297
  5. Zend_Db_Statement->execute() in ***\xf\library\Zend\Db\Adapter\Abstract.php at line 479
  6. Zend_Db_Adapter_Abstract->query() in ***\xf\library\XenForo\Model\Template.php at line 581
  7. XenForo_Model_Template->deleteTemplatesInStyle() in ***\xf\library\XenForo\Model\Style.php at line 510
  8. XenForo_Model_Style->importStyleXml() in ***\xf\library\XenForo\ControllerAdmin\Style.php at line 181
  9. XenForo_ControllerAdmin_Style->actionImport() in ***\xf\library\XenForo\FrontController.php at line 310
  10. XenForo_FrontController->dispatch() in ***\xf\library\XenForo\FrontController.php at line 132
  11. XenForo_FrontController->run() in ***\xf\admin.php at line 13
On a computer at work, I use the XAMPP server 1.7.4 (PHP: 5.3.5).

Although previously hadn't any problems.
 
R

ragtek

Guest
#2
I think that's a bug in XenForo_Model_Template

PHP:
$db->query('
                DELETE FROM xf_template_compiled
                WHERE style_id = 0
                    AND title IN (' . $db->quote($titles) . ')
            ', $styleId);
should probably be
PHP:
$db->query('
                DELETE FROM xf_template_compiled
                WHERE style_id = 0
                    AND title IN (' . $db->quote($titles) . ')
            ');
 

Rigel Kentaurus

Well-known member
#3
2 computers and 2 installed copies of the XF on the localhost for testing.

Yesterday I updated the first copy at home with beta 3. Then I updated a couple of styles. I exported the XML files and take them to work.

At work, I also updated the forum with beta 3. I'm trying to import styles and get an error.

On a computer at work, I use the XAMPP server 1.7.4 (PHP: 5.3.5).

Although previously hadn't any problems.
If you want a workaround, instead of replacing the style, import it as a new style. That will work. You can then delete the other style.
 

Romchik®

Well-known member
#5
hm...
My style contains the following CSS in EXTRA.css:
Code:
background-color:@primaryLight;

...

background:url('@imagePath/xenforo/gradients/category-23px-light.png') repeat-x top;
...

margin-left:-{xen:calc '@content.padding-right + 5'}px;
I have replaced with:
Code:
background-color:{xen:property primaryLight};

...

background:url('{xen:property imagePath}/xenforo/gradients/category-23px-light.png') repeat-x top;

...
 
margin-left:-{xen:calc '{xen:property content.padding-right} + 5'}px;
And error above (Line 464: Invalid math expression) has gone...
 

Mike

XenForo developer
Staff member
#6
That section of code should actually be:

Code:
            $db->query('
                DELETE FROM xf_template_compiled
                WHERE style_id = ?
                    AND title IN (' . $db->quote($titles) . ')
            ', $styleId);
            if (XenForo_Application::get('options')->templateFiles)
            {
                XenForo_Template_FileHandler::delete($titles, $styleId, null);
            }