Incompatibility errors with after PHP 7.0

Incompatibility errors with after PHP 7.0

The only errors that may occur are due to codes used in events, libraries, and methods that are not compatible with PHP 7.0. These errors must be corrected manually.


1 - Short open tags

The short_open_tag directive tells PHP whether the abbreviated form (<? ?>) of the PHP opening tag is allowed.

Regardless of the php version, you need to check in php.ini if short_open_tags is enabled.

Solution 1:
Change the opening tag of php to (<?php ?>)
Solution 2:
Change the short_open_tags directive in php.ini:

short_open_tags = On


2 - New objects cannot be assigned by reference

The result of the new statement can no longer be assigned to a variable by reference:
<?php
class C {}
$c =& new C;
?>

The example above will print in PHP 5:
              Deprecated: Assigning the return value of new by reference is deprecated in /tmp/test.php on line 3

The above example will print in PHP 7:
              Parse error: syntax error, unexpected 'new' (T_NEW) in /tmp/test.php on line 3

Solution:
              Remove reference (&) from assignment:

<?php
class C {}
$c = new C;
?>


3 - PHP 4 Style Constructors

PHP 4 style constructors (methods that have the same name as the class where they are defined) are deprecated, and will be removed in the future. PHP 7 will issue E_DEPRECATED if a PHP 4 constructor is the only constructor defined in the class. Classes that implement the __construct () method are not affected.

<?php
class foo {
    function foo() {
        echo 'Eu sou um construtor';
    }
}
?>

The above example will print:

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in example.php on line 3


4 - Static calls to non-static methods

Static calls to methods that have not been declared as static are deprecated, and can be removed in the future.

<?php
class foo {
    function bar() {
        echo 'Eu não sou estático!';
    }
}

foo::bar();

?>

The above example will print:

Deprecated: Non-static method foo::bar() should not be called statically in - on line 8
I am not static!


For more information:

PHP 7.0 new features
  - PHP 7.0 deprecated features


Source: http://php.net

    • Related Articles

    • PHP error level - error_reporting

      The error_reporting directive in php.ini defines the levels of errors that PHP will report, the levels of errors are:   Errors and Logging Value Constant Description Note 1 E_ERROR (integer) Fatal run-time errors. These indicate errors that can not ...
    • PHP extensions

      In php.ini there is the following extensions: If you would like to use one of those extension, for example MySQL, do the following: Remove the character ";" at the beginning of the extension Ex: extension = php_mysql.dll Save the file and restart the ...
    • Updating Scriptcase's PHP

      Currently, the installation of Scriptcase 9.x comes with version 7.0.14 of PHP, unfortunately, this version has a compatibility problem with the new version of authentication of MySQL 8.0, so it is necessary to perform the PHP update so the ...
    • Installing PHP 7.0 - Windows

      This article explains PHP 7.0 and Apache 2.4 installation to ScriptCase use. Supported Operating Systems: Windows Server 2008 SP2 2008 R2 SP1 2012 2012 SP2 2016 Windows 7 SP1 Vista SP2 8 8.1 10 Necessary Files: PHP 7.0: Click Here Apache 2.4: Click ...
    • Installing PHP 7.0 - Linux

      This article describes PHP 7.0 and Apache 2.4 installation to ScriptCase use. Supported Operating Systems: Ubuntu Debian CentOS\RHEL OpenSuse Necessary Files: SourceGuardian Loader (ixed.7.0.lin): Click Here Setting Up PHP - Ubuntu Because of recent ...
    • Popular Articles

    • Examples for diagrams

      This tutorial shows how you can import and use the new examples for diagrams released with Scriptpcase V9.2.16.  The applications were created using the components: Jsmind, JKanban e Orgchart.  - Sample 1: Mind Map diagram Click here to  execute the ...
    • PHP functions necessary for ScriptCase

      In PHP , there are some essential functions for the operation of Scriptcase .  On some servers , these functions are disabled , this makes the Scriptcase not work properly.  If you're using a shared hosting server, you'll need to contact the host ...
    • Oracle Connection - Scriptcase 9 - Linux 64 Bits

      This procedure will only work if you have a Scriptcase manual installation in your server. Installing PHP 7.0 Installing the Scriptcase Manually To connect with Oracle in a Linux System, we must follow these steps below: Step 1 -  Installing these ...
    • Using friendly URL

      The friendly URL was included from Scriptcase 7, in order to make the URL, of the applications generated by Scriptcase, cleaner and easier to associate them with applications. For example, using friendly URLs the link to a Scriptcase application ...
    • Correcting access error for the Scriptcase database

      Sometimes we encounter an error accessing the Scriptcase database itself, as shown in the image below:   This problem happens when we change the folder name of the scriptcase to another name, such as "sc". Then, the error happens because the complete ...