Fixed Undefined index: propertyName

Romchik®

Well-known member
Looks like just me have this problem?

This occurs if I open any template.
Undefined index: propertyName
  1. XenForo_Application::handlePhpError() in XenForo/Model/StyleProperty.php at line 2415
  2. XenForo_Model_StyleProperty->_propertyToAtScalarCallback()
  3. preg_replace_callback() in XenForo/Model/StyleProperty.php at line 2408
  4. XenForo_Model_StyleProperty->replacePropertiesInTemplateForEditor() in XenForo/ControllerAdmin/Template.php at line 236
  5. XenForo_ControllerAdmin_Template->actionLoadMultiple() in XenForo/FrontController.php at line 313
  6. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
  7. XenForo_FrontController->run() in /***/admin.php at line 13
 
I'm not sure how that could happen.

It's related to a 1.1.5 bug fix, but somehow the named captures don't seem to be there -- but this is something we use all over XF so I think you should've run into it before.

I'd need FTP and admin access to try to debug it. (Best to submit a ticket with these details if possible, referencing this thread.)
 
possible fix for php 5.2.x
in file XenForo/Model/StyleProperty.php find
PHP:
	protected static function _propertyToAtScalarCallback(array $match)
	{
and replace with:
PHP:
	protected static function _propertyToAtScalarCallback(array $match)
	{
		if (!isset($match['propertyName']))
		{
			// if named backreferences not supported
			$match['propertyName'] = $match[2];
			if (isset($match[3]))
			{
				$match['propertyComponent'] = $match[3];
			}
		}
 
Just using a simpler fix that seems to be ok (just always uses the numbered versions to be safe)

Code:
$match['propertyName'] = $match[2];
$match['propertyComponent'] = isset($match[3]) ? $match[3] : null;

I have updated the package to prevent this error.

Good catch. :)
 
Top Bottom