Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Blog Module /

Discuss the Blog Module.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

[Notice] Array to string conversion


Go to End


3 Posts   3794 Views

Avatar
Media Contour

Community Member, 33 Posts

27 October 2009 at 6:15am

Edited: 27/10/2009 6:16am

Installed the blog module and I got an error that I found a fix for on this forum.

Now I have this new error. How can I fix this?

[Notice] Array to string conversion
GET /fit/blog/?flush=1

Line 16 in /Users/gforce/Desktop/Repository/fit/sapphire/core/model/fieldtypes/Date.php

SOURCE

class Date extends DBField {
	
	function setValue($value) {
	    if( is_array( $value ) && $value['Day'] && $value['Month'] && $value['Year'] ) {
	    	$this->value = $value['Year'] . '-' . $value['Month'] . '-' . $value['Day'];
	    	return;
	    }
	    
	    // Default to NZ date format - strtotime expects a US date
	    if(ereg('^([0-9]+)/([0-9]+)/([0-9]+)$', $value, $parts)) 
	    	$value = "$parts[2]/$parts[1]/$parts[3]";
	
	    if($value && is_string($value)) $this->value = date('Y-m-d', strtotime($value));
	    else $value = null;
	}

Avatar
keeny

Community Member, 48 Posts

20 January 2010 at 11:03am

Maybe check the database BlogEntry and BlogEntry_Live tables for blogs entries with Null or malformed dates?

Avatar
Media Contour

Community Member, 33 Posts

20 January 2010 at 11:14am

I remember posting this.

I know its no longer an issue though. Don't know how I fixed it though :\