Categories > TinyButStrong general >

PHP Fatal error when field is feed a DateTime object

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Sheepy
Date: 2013-08-23
Time: 10:20

PHP Fatal error when field is feed a DateTime object

Code execution will stop whenever a DateTime object is feed into TBS, whether the field is formatted or not.

include( 'tbs_class.php' );
$TBS = new clsTinyButStrong();

$TBS->Source = 'Today is [datetime;frm=yyyy-mm-dd]';

$TBS->MergeField( 'datetime', new DateTime() );

$TBS->Show();

I discovered this while working on a project with MS SQL (php_sqlsrv) which returns datetime fields as a core PHP DateTime object.

Although in my case it is possible to move the formatting back to the query, it'd be nice if it can be done on the presentation layer instead.

Is it sensible to request for support of datetime object, at least for date formatted fields?
By: Skrol29
Date: 2013-08-25
Time: 23:56

Re: PHP Fatal error when field is feed a DateTime object

Hi Sheepy,

I new version of TBS was about to be out.
I will add the support for DateTime objects and also objects with the magic method __toString().

It should be available if few days.
By: Skrol29
Date: 2013-08-26
Time: 01:48

Re: PHP Fatal error when field is feed a DateTime object

By: Sheepy
Date: 2013-08-26
Time: 06:11

Re: PHP Fatal error when field is feed a DateTime object

Hi Skrol,

That is a lot quicker then 'a few days'! :D The beta works, thanks a lot.