Constructor obsoleto
-
Revisando en local me he encontrado con el siguiente mensaje de error correspondiente al plugin Broken Link Checker:
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; blcTablePrinter has a deprecated constructor in C:\.......\wp-content\plugins\broken-link-checker\includes\admin\table-printer.php on line 11Este mensaje aparece cuando, estando en la administración, se accede a la sección de «Enlaces rotos». La tabla es la que muestra todos los enlaces con sus correspondientes filtros.
La función completa es:
class blcTablePrinter { var $current_filter; //The current search filter. Also contains the list of links to display. var $page; //The current page number var $per_page; //Max links per page /** @var wsBrokenLinkChecker */ var $core; //A reference to the main plugin object var $neutral_current_url; //The "safe" version of the current URL, for use in the bulk action form. var $bulk_actions_html = ''; var $pagination_html = ''; var $searched_link_type = ''; var $columns; var $layouts; function blcTablePrinter($core){ $this->core = $core; //Initialize layout and column definitions $this->setup_columns(); $this->setup_layouts(); //Figure out what the "safe" URL to acccess the current page would be. //This is used by the bulk action form. $special_args = array('_wpnonce', '_wp_http_referer', 'action', 'selected_links'); $this->neutral_current_url = remove_query_arg($special_args); }Lo que he hecho para solucionarlo ha sido sustituir
function blcTablePrinter($core){por
function __construct($core){El mensaje de error ha desaparecido y todo parece funcionar correctamente. No obstante, me gustaría que algún experto en PHP confirmara que la solución es la apropiada.
El debate ‘Constructor obsoleto’ está cerrado a nuevas respuestas.