Biju P Dais
Biju P Dais

Reputation: 131

FatFree Framework - The (unset) cast is deprecated

I am having a system built in FatFree framework and I am having an error when running one of my scripts(error given below).

On research, I found two github posts related to this(listed below), but can't figure out how to fix the issue or where to make the changes to fix the issue. Could anyone help me please?

https://github.com/bcosca/fatfree/issues/1080

https://github.com/SSilence/selfoss/issues/983

Internal Server Error

The (unset) cast is deprecated

[ctdata/lib/base.php:2032] Base->error(500,'The (unset) cast is deprecated')
[ctdata/lib/base.php:1899] Base->{closure}(8192,'The (unset) cast is deprecated','/home/ezcomp5/public_html/ctdata/lib/db/sql.php',110,array('class'=>'DB/SQL','func'=>NULL,'path'=>'./','auto'=>'/home/ezcomp5/public_html/ctdata/lib/','file'=>'/home/ezcomp5/public_html/ctdata/lib/db/sql.php'))
[ctdata/lib/base.php:1899] require()
[ctdata/index.php:37] spl_autoload_call('DB\SQL')

Upvotes: 0

Views: 2636

Answers (2)

zanderwar
zanderwar

Reputation: 3730

That is merely a deprecation warning for coercing NULL with (unset).

See type juggling.

For example

$uselessCoercion = 'Hello';
$uselessCoercion = (unset)$uselessStuff;

// is the same as
$uselessCoercion = NULL;

NB. It's mentioned that setting a variable to NULL before using unset() is actually a performance tweak (albeit pedantic). As that way, the original value is definitely erased from memory.

A deprecation note from the docs:

The (unset) cast has been deprecated as of PHP 7.2.0. Note that the (unset) cast is the same as assigning the value NULL to the variable or call. The (unset) cast will be removed as of PHP 8.0.0.

If you're unable to change the code, you can just disable it in php.ini

error_reporting = E_ALL & ~E_DEPRECATED & ~E_NOTICE & ~E_WARNING

Ideally, you should be fixing these issues but the above is pretty generic for a production server where you're wanting to hide any bad eggs

If you're unable to modify php.ini then maybe you're able to revert to a version lower than 7.2.0

Upvotes: 2

xfra35
xfra35

Reputation: 3908

Just upgrade your version of Fat-Free Framework. This error has been fixed in 3.6.3. See https://github.com/bcosca/fatfree-core/blob/master/CHANGELOG.md

Upvotes: 4

Related Questions