WordPress.org

Support

Support » Themes and Templates » [Resolved] P2 Theme with a fatal error – worked initially ok?

[Resolved] P2 Theme with a fatal error – worked initially ok?

  • Hi guys

    I have looked through the forums and this appears to be a new P2 error:-

    Fatal error: Call to undefined function: str_split() in /nfs/c03/h03/mnt/55103/domains/newsdesk.thedailydust.co.uk/html/wp-content/themes/p2/functions.php on line 352

    I am running WP 2.7.1
    And P2 Version P2 1.0.4

    I added around 7 posts this am, but this error suddenly displayed. Any help or fixes would be great, thanks

    Just realised this is a Theme issue – can someone let me know how to remove the (now) duplicate post from the How-to and troubleshooting?

Viewing 6 replies - 1 through 6 (of 6 total)
  • This is still not solved guys, thanks

    It may also help to add that there are zero plugins on this theme

    I managed to fix this by simply changing the PHP version from 4 to 5. It seems version 4 does not work with P2.

    Yeh, str_split() is PHP 5 only. Maybe they should mention that on the theme details page…or write a custom function to replicate it in PHP 4 environments

    Anyone else that has this problem, try adding this to the bottom of your theme’s function.php file:

    if (!function_exists('str_split')) {
    	function str_split($string, $string_length = 1) {
    		if ($string_length < 1 || !$string_length) {
    			return false;
    		}
    
    		$parts = array();
    
    		if ($parts === 1 || $string_length > strlen($string)) {
    			$parts = array($string);
    		} else {
    			do {
    				$parts[] = substr($string, 0, $string_length);
    				$string = substr($string, $string_length);
    			} while ($string !== false);
    		}
    
    		return $parts;
    	}
    }

    Again, this is really only a problem for people in PHP 4 environments.

    Thanks for your help providing a fix @tjeastmond

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] P2 Theme with a fatal error – worked initially ok?’ is closed to new replies.
Skip to toolbar