wifidog / wifidog-auth

Repository for the PHP wifidog captive portal auth server
196 stars 117 forks source link

PHP 5.6 incompatibility #17

Open diegohdk opened 8 years ago

diegohdk commented 8 years ago

Running the server on a PHP 5.6 installation, on step Database Initialisation we see the following:

Runtime Notice: Declaration of File::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/File/File.php
Runtime Notice: Declaration of ContentGroupElement::processNewContentUI() should be compatible with Content::processNewContentUI($user_prefix) in /var/www/html/classes/Content/ContentGroup/ContentGroupElement.php
Runtime Notice: Declaration of ContentGroupElement::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/ContentGroup/ContentGroupElement.php
Runtime Notice: Declaration of Node::freeObject() should be compatible with HotspotGraphElement::freeObject($id, $type) in /var/www/html/classes/Node.php on line 65
Runtime Notice: Declaration of Node::createNewObject() should be compatible with HotspotGraphElement::createNewObject($element_id, $element_type, $parent_element = NULL) in /var/www/html/classes/Node.php on line 65
Runtime Notice: Declaration of EmbeddedContent::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/EmbeddedContent/EmbeddedContent.php
Runtime Notice: Declaration of Langstring::processNewUI() should be compatible with Content::processNewUI($contentId, $checkOnly = false, $userData = NULL) in /var/www/html/classes/Content/Langstring/Langstring.php
Runtime Notice: Declaration of Langstring::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/Langstring/Langstring.php
Runtime Notice: Declaration of IFrame::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/IFrame/IFrame.php
Runtime Notice: Declaration of PatternLanguage::getUserUI() should be compatible with ContentGroup::getUserUI($hide_elements = false) in /var/www/html/classes/Content/PatternLanguage/PatternLanguage.php
Runtime Notice: Declaration of PatternLanguage::getAllContent() should be compatible with Content::getAllContent($content_type = '') in /var/www/html/classes/Content/PatternLanguage/PatternLanguage.php
Runtime Notice: Declaration of RssAggregator::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/RssAggregator/RssAggregator.php
Runtime Notice: Declaration of ShoutBox::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/ShoutBox/ShoutBox.php
Runtime Notice: Declaration of SmartyTemplate::getString() should be compatible with Langstring::getString($verbose = true) in /var/www/html/classes/Content/SmartyTemplate/SmartyTemplate.php
Runtime Notice: Declaration of UIAllowedBandwidth::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/UIAllowedBandwidth/UIAllowedBandwidth.php
Runtime Notice: Declaration of UIUserList::getUserUI() should be compatible with Content::getUserUI($subclass_user_interface = NULL) in /var/www/html/classes/Content/UIUserList/UIUserList.php
Runtime Notice: Declaration of NodeGroup::freeObject() should be compatible with HotspotGraphElement::freeObject($id, $type) in /var/www/html/classes/NodeGroup.php
Runtime Notice: Declaration of NodeGroup::createNewObject() should be compatible with HotspotGraphElement::createNewObject($element_id, $element_type, $parent_element = NULL) in /var/www/html/classes/NodeGroup.php
Runtime Notice: Declaration of Network::freeObject() should be compatible with HotspotGraphElement::freeObject($id, $type) in /var/www/html/classes/Network.php on line 71
Runtime Notice: Declaration of Network::createNewObject() should be compatible with HotspotGraphElement::createNewObject($element_id, $element_type, $parent_element = NULL) in /var/www/html/classes/Network.php on line 71
Notice: Use of undefined constant CONF_DATABASE_NAME - assumed 'CONF_DATABASE_NAME' in /var/www/html/classes/AbstractDb.php on line 91
Notice: Use of undefined constant CONF_DATABASE_HOST - assumed 'CONF_DATABASE_HOST' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_PORT - assumed 'CONF_DATABASE_PORT' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_USER - assumed 'CONF_DATABASE_USER' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_PASSWORD - assumed 'CONF_DATABASE_PASSWORD' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_HOST - assumed 'CONF_DATABASE_HOST' in /var/www/html/classes/AbstractDb.php on line 103
Notice: Use of undefined constant CONF_DATABASE_PORT - assumed 'CONF_DATABASE_PORT' in /var/www/html/classes/AbstractDb.php on line 103
Notice: Use of undefined constant CONF_DATABASE_USER - assumed 'CONF_DATABASE_USER' in /var/www/html/classes/AbstractDb.php on line 103
Notice: Use of undefined constant NODE_PUBLIC_STATS_DIR - assumed 'NODE_PUBLIC_STATS_DIR' in /var/www/html/include/path_defines_url_content.php on line 151
Notice: Use of undefined constant CONF_DATABASE_NAME - assumed 'CONF_DATABASE_NAME' in /var/www/html/classes/AbstractDb.php on line 91
Notice: Use of undefined constant CONF_DATABASE_HOST - assumed 'CONF_DATABASE_HOST' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_PORT - assumed 'CONF_DATABASE_PORT' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_USER - assumed 'CONF_DATABASE_USER' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_PASSWORD - assumed 'CONF_DATABASE_PASSWORD' in /var/www/html/classes/AbstractDb.php on line 94
Notice: Use of undefined constant CONF_DATABASE_HOST - assumed 'CONF_DATABASE_HOST' in /var/www/html/classes/AbstractDb.php on line 103
Notice: Use of undefined constant CONF_DATABASE_PORT - assumed 'CONF_DATABASE_PORT' in /var/www/html/classes/AbstractDb.php on line 103
Notice: Use of undefined constant CONF_DATABASE_USER - assumed 'CONF_DATABASE_USER' in /var/www/html/classes/AbstractDb.php on line 103

These runtime notices are due to the subclasses having different method signatures from their parent classes. Disabling the runtime notices on PHP 5.4 seemed to work, but on 5.6 don't.

Unfortunately I can't downgrade PHP. So is there any chance to get these classes updated for PHP 5.4+?

benoitg commented 8 years ago

If you send a patch, it will be accepted.

littlewine commented 8 years ago

I am having the same problem, but downgrading to php 5.4.45 didn't solve the problem. diegohdk , are you sure this is the issue and disabling runtime notices is the solution?

diegohdk commented 8 years ago

Yes @littlewine. I had this type of issue in other situations and disabling the notices solved. But this is not a real solution, because the problem is still there. With the time I realized that I really had to fix my classes, and so changed their methods signatures.

Anyway, in that case my PHP version was 5.4.12. Maybe you have to downgrade even more for this to work.

littlewine commented 8 years ago

@diegohdk could you please share the updated code with the method signatures? Could you also provide more info on how to disable notices? will a simple block of code do the trick ? error_reporting(0); Unfortunately I am unable to set up the server so it is not really easy for me to go ahead and change the php classes or explore the functionality of the script to check if it covers my needs. Thank you in advance , Tony

diegohdk commented 8 years ago

Hello @littlewine. I don't have an updated version of these classes. The fix that I mentioned was on another project.

I could make a fix for this project too but I don't have time at this moment.

But to help you, on my other project I disabled these errors by changing error_reporting on .htaccess, like this:

<IfModule mod_php5.c>
    php_value error_reporting "E_ALL ^ E_STRICT"
</IfModule>

The .htaccess must to be at your project's root.

Note: this will only work if your web server is Apache. For other servers you might find another way.