Title: PHP 8.0 issue: deprecated create_function() and curly braces
Last modified: January 10, 2021

---

# PHP 8.0 issue: deprecated create_function() and curly braces

 *  [Gwyneth Llewelyn](https://wordpress.org/support/users/gwynethllewelyn/)
 * (@gwynethllewelyn)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/php-8-0-issue-deprecated-create_function-and-curly-braces/)
 * Hi there,
 * I’m aware that this plugin is discontinued (even the free version hosted here),
   but I’d like to point out that there are a few issues when using it under PHP
   8.0
 * There is a call to the obsolete, deprecated and now removed `create_function()`
   on line 77 of `wp-filebase/wp-filebase.php`. This was an ancient hack from the
   PHP 4 days which has survived until now. PHP has supported anonymous functions(
   or closures) for quite a long time now, and these are free from the security 
   issues (usage of `eval()`…) and bad performance of `create_function()`.
 * You will basically need to rewrite line 77 in the following way:
    `return function(){
   $p=func_get_args();return wpfb_call("' . $cl . '","' . $fnc . '",$p,true); };`
 * There is also a nasty habit of using curly braces `{}` to address array indexes.
   This was once common practice under very early versions of PHP but has been made
   obsolete years ago. PHP 7.4 flags them as deprecated; PHP 8.0 finally removes
   them.
 * You’ll have to go through at least
 *     ```
       wp-filebase/classes/Item.php
       wp-filebase/classes/File.php
       wp-filebase/classes/Output.php
       wp-filebase/classes/ProgressReporter.php
       wp-filebase/classes/GetID3.php
       wp-filebase/classes/Admin.php
       wp-filebase/classes/Search.php
       wp-filebase/classes/Sync.php
       wp-filebase/classes/Download.php
       wp-filebase/classes/Setup.php
       ```
   
 * and manually search for things such as `$opt{0}`, `$val{1}` and similar constructs
   etc., and change them to `$opt[0]`, `$val[1]` and so forth. This is one of those
   things that takes time and patience and is not trivial to automate (you can try,
   using regular expressions, and a tool such as `sed`… make sure you’ve made a 
   backup first!).
 * Once the ‘core’ plugin is thus ‘cleaned up’, there are many more of those to 
   fix under the `extras` and `vendor` directories… just a quick search for `{0`
   gives a hundred results or so, and there are possibly many more instances.
    -  This topic was modified 5 years, 3 months ago by [Gwyneth Llewelyn](https://wordpress.org/support/users/gwynethllewelyn/).
    -  This topic was modified 5 years, 3 months ago by [Gwyneth Llewelyn](https://wordpress.org/support/users/gwynethllewelyn/).

Viewing 1 replies (of 1 total)

 *  [mazza](https://wordpress.org/support/users/mazza/)
 * (@mazza)
 * [5 years, 1 month ago](https://wordpress.org/support/topic/php-8-0-issue-deprecated-create_function-and-curly-braces/#post-14151113)
 * thank you very much for the indication. Do you think this is enough for the plugin
   to survive php8?

Viewing 1 replies (of 1 total)

The topic ‘PHP 8.0 issue: deprecated create_function() and curly braces’ is closed
to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-filebase_ffff6e.svg)
 * [WP-Filebase Download Manager](https://wordpress.org/plugins/wp-filebase/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-filebase/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-filebase/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-filebase/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-filebase/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-filebase/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [mazza](https://wordpress.org/support/users/mazza/)
 * Last activity: [5 years, 1 month ago](https://wordpress.org/support/topic/php-8-0-issue-deprecated-create_function-and-curly-braces/#post-14151113)
 * Status: not resolved