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.

Customising the CMS /

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

CMS Save and Close button issue


Go to End


3 Posts   1912 Views

Avatar
Hal Ford

Community Member, 2 Posts

21 January 2016 at 10:57am

Hi. I am having an issue when trying to Save and Close a data object in the CMS. It looks like there is some sort of date error occurring.

I found this in the source code on the page.

<> y 1002: if (isset($result['month']) and isset($result['year'])) { 1003: if ($result['month'] > 31) { 1004: if ($options['fix_date'] !== true) { * 1005: iconv_set_encoding('internal_encoding', $oenc); 1006: require_once 'Zend/Locale/Exception.php'; 1007: throw new Zend_Locale_Exception("Unable to parse date '$date' using '" 1008: . $format . "' (M <> y)"); 1009: } 1010: $temp = $result['year']; 1011: $result['year'] = $result['month']; Trace ===== iconv_set_encoding(internal_encoding,UTF-8) Format.php:1005 Zend_Locale_Format::_parseDate(2016-01-01,Array) Format.php:1118 Zend_Locale_Format::getDate(2016-01-01,Array) Date.php:4768 Zend_Date::isDate(2016-01-01,MMM d, y,en_GB) DateField.php:252 DateField->setValue(2016-01-01,JobListing) Form.php:1229 Form->loadDataFrom(JobListing,0) GridFieldDetailForm.php:409 GridFieldDetailForm_ItemRequest->ItemEditForm(GridField,SS_HTTPRequest) GridFieldDetailForm.php:297 GridFieldDetailForm_ItemRequest->edit(SS_HTTPRequest) RequestHandler.php:288 RequestHandler->handleAction(SS_HTTPRequest,edit) RequestHandler.php:200 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) GridFieldDetailForm.php:99 GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest) GridField.php:716 GridField->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) Controller.php:153 Controller->handleRequest(SS_HTTPRequest,DataModel) LeftAndMain.php:441 LeftAndMain->handleRequest(SS_HTTPRequest,DataModel) AdminRootController.php:93 AdminRootController->handleRequest(SS_HTTPRequest,DataModel) Director.php:366 Director::handleRequest(SS_HTTPRequest,Session,DataModel) Director.php:152 Director::direct(/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit,DataModel) main.php:189 ERROR [Deprecated]: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated IN GET /lwb/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit Line 782 in /Applications/MAMP/htdocs/lwb/framework/thirdparty/Zend/Locale/Format.php Source ====== 773: $test = array('h', 'H', 'm', 's', 'y', 'Y', 'M', 'd', 'D', 'E', 'S', 'l', 'B', 'I', 774: 'X', 'r', 'U', 'G', 'w', 'e', 'a', 'A', 'Z', 'z', 'v'); 775: 776: $format = $options['date_format']; 777: $number = $date; // working copy 778: $result['date_format'] = $format; // save the format used to normalize $number (convenience) 779: $result['locale'] = $options['locale']; // save the locale used to normalize $number (convenience) 780: 781: $oenc = iconv_get_encoding('internal_encoding'); * 782: iconv_set_encoding('internal_encoding', 'UTF-8'); 783: $day = iconv_strpos($format, 'd'); 784: $month = iconv_strpos($format, 'M'); 785: $year = iconv_strpos($format, 'y'); 786: $hour = iconv_strpos($format, 'H'); 787: $min = iconv_strpos($format, 'm'); 788: $sec = iconv_strpos($format, 's'); Trace ===== iconv_set_encoding(internal_encoding,UTF-8) Format.php:782 Zend_Locale_Format::_parseDate(2016-01-01,Array) Format.php:1118 Zend_Locale_Format::getDate(2016-01-01,Array) Date.php:4768 Zend_Date::isDate(2016-01-01,yyyy-MM-dd) DateField.php:258 DateField->setValue(2016-01-01,JobListing) Form.php:1229 Form->loadDataFrom(JobListing,0) GridFieldDetailForm.php:409 GridFieldDetailForm_ItemRequest->ItemEditForm(GridField,SS_HTTPRequest) GridFieldDetailForm.php:297 GridFieldDetailForm_ItemRequest->edit(SS_HTTPRequest) RequestHandler.php:288 RequestHandler->handleAction(SS_HTTPRequest,edit) RequestHandler.php:200 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) GridFieldDetailForm.php:99 GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest) GridField.php:716 GridField->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) Controller.php:153 Controller->handleRequest(SS_HTTPRequest,DataModel) LeftAndMain.php:441 LeftAndMain->handleRequest(SS_HTTPRequest,DataModel) AdminRootController.php:93 AdminRootController->handleRequest(SS_HTTPRequest,DataModel) Director.php:366 Director::handleRequest(SS_HTTPRequest,Session,DataModel) Director.php:152 Director::direct(/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit,DataModel) main.php:189 ERROR [Deprecated]: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated IN GET /lwb/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit Line 1048 in /Applications/MAMP/htdocs/lwb/framework/thirdparty/Zend/Locale/Format.php Source ====== 1039: if ($result['year'] < 70) { 1040: $result['year'] = (int) $result['year'] + 100; 1041: } 1042: 1043: $result['year'] = (int) $result['year'] + 1900; 1044: } 1045: } 1046: } 1047: * 1048: iconv_set_encoding('internal_encoding', $oenc); 1049: return $result; 1050: } 1051: 1052: /** 1053: * Search $number for a month name found in $monthlist, and replace if found. 1054: * Trace ===== iconv_set_encoding(internal_encoding,UTF-8) Format.php:1048 Zend_Locale_Format::_parseDate(2016-01-01,Array) Format.php:1118 Zend_Locale_Format::getDate(2016-01-01,Array) Date.php:4768 Zend_Date::isDate(2016-01-01,yyyy-MM-dd) DateField.php:258 DateField->setValue(2016-01-01,JobListing) Form.php:1229 Form->loadDataFrom(JobListing,0) GridFieldDetailForm.php:409 GridFieldDetailForm_ItemRequest->ItemEditForm(GridField,SS_HTTPRequest) GridFieldDetailForm.php:297 GridFieldDetailForm_ItemRequest->edit(SS_HTTPRequest) RequestHandler.php:288 RequestHandler->handleAction(SS_HTTPRequest,edit) RequestHandler.php:200 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) GridFieldDetailForm.php:99 GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest) GridField.php:716 GridField->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) Controller.php:153 Controller->handleRequest(SS_HTTPRequest,DataModel) LeftAndMain.php:441 LeftAndMain->handleRequest(SS_HTTPRequest,DataModel) AdminRootController.php:93 AdminRootController->handleRequest(SS_HTTPRequest,DataModel) Director.php:366 Director::handleRequest(SS_HTTPRequest,Session,DataModel) Director.php:152 Director::direct(/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit,DataModel) main.php:189 ERROR [Deprecated]: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated IN GET /lwb/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit Line 782 in /Applications/MAMP/htdocs/lwb/framework/thirdparty/Zend/Locale/Format.php Source ====== 773: $test = array('h', 'H', 'm', 's', 'y', 'Y', 'M', 'd', 'D', 'E', 'S', 'l', 'B', 'I', 774: 'X', 'r', 'U', 'G', 'w', 'e', 'a', 'A', 'Z', 'z', 'v'); 775: 776: $format = $options['date_format']; 777: $number = $date; // working copy 778: $result['date_format'] = $format; // save the format used to normalize $number (convenience) 779: $result['locale'] = $options['locale']; // save the locale used to normalize $number (convenience) 780: 781: $oenc = iconv_get_encoding('internal_encoding'); * 782: iconv_set_encoding('internal_encoding', 'UTF-8'); 783: $day = iconv_strpos($format, 'd'); 784: $month = iconv_strpos($format, 'M'); 785: $year = iconv_strpos($format, 'y'); 786: $hour = iconv_strpos($format, 'H'); 787: $min = iconv_strpos($format, 'm'); 788: $sec = iconv_strpos($format, 's'); Trace ===== iconv_set_encoding(internal_encoding,UTF-8) Format.php:782 Zend_Locale_Format::_parseDate(2016-01-01,Array) Format.php:1118 Zend_Locale_Format::getDate(2016-01-01,Array) Date.php:2629 Zend_Date->_calculate(set,2016-01-01,yyyy-MM-dd,en_US) Date.php:1078 Zend_Date->set(2016-01-01,yyyy-MM-dd,en_US) Date.php:197 Zend_Date->__construct(2016-01-01,yyyy-MM-dd) DateField.php:259 DateField->setValue(2016-01-01,JobListing) Form.php:1229 Form->loadDataFrom(JobListing,0) GridFieldDetailForm.php:409 GridFieldDetailForm_ItemRequest->ItemEditForm(GridField,SS_HTTPRequest) GridFieldDetailForm.php:297 GridFieldDetailForm_ItemRequest->edit(SS_HTTPRequest) RequestHandler.php:288 RequestHandler->handleAction(SS_HTTPRequest,edit) RequestHandler.php:200 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) GridFieldDetailForm.php:99 GridFieldDetailForm->handleItem(GridField,SS_HTTPRequest) GridField.php:716 GridField->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) RequestHandler.php:222 RequestHandler->handleRequest(SS_HTTPRequest,DataModel) Controller.php:153 Controller->handleRequest(SS_HTTPRequest,DataModel) LeftAndMain.php:441 LeftAndMain->handleRequest(SS_HTTPRequest,DataModel) AdminRootController.php:93 AdminRootController->handleRequest(SS_HTTPRequest,DataModel) Director.php:366 Director::handleRequest(SS_HTTPRequest,Session,DataModel) Director.php:152 Director::direct(/admin/Listings/JobListing/EditForm/field/JobListing/item/48328/edit,DataModel) main.php:189 ERROR [Deprecated]: iconv_set_encoding(): Use of iconv.internal_encoding is deprecated IN …

Any help would be greatly appreciated.

Thanks

Hal

Avatar
Devlin

Community Member, 344 Posts

21 January 2016 at 9:51pm

As it is said in the error message: "Use of iconv.internal_encoding is deprecated." [...] in PHP 5.6

You'll have to update the framework or downgrade to PHP 5.5.x

Avatar
Hal Ford

Community Member, 2 Posts

22 January 2016 at 3:53pm

Thanks. That worked perfectly :)