PHP 5.4.40 Released

Nicht rückwärtskompatible Änderungen

Obwohl der meiste PHP 5 basierende Code ohne Änderungen funktionieren sollte, gibt einige nicht rückwärtskompatible Änderungen:

Die folgenden Schlüsselwörter sind nun reserviert und dürfen nicht in Funktions-, Klassen- usw. namen genutzt werden.

add a note add a note

User Contributed Notes 7 notes

up
12
ky dot patterson at adlinkr dot com
8 months ago
If you have content that is not 100% UTF-8 then TAKE NOTE:

Starting in PHP 5.4 htmlspecialchars() and htmlentities() assume charset=UTF-8 by default AND WILL RETURN BLANK IF YOUR INPUT IS NOT VALID UTF-8.

So if you have a lot of function calls that look like this:
<?php
echo htmlspecialchars($input);
// or
echo htmlentities($input);
?>
i.e. no charset and no flags -- and $input is ISO-8859 (or anything else apart from 7-bit ASCII or UTF-8) -- then PHP 5.4 and 5.5 will return an empty string, and you will be surprised and probably unhappy.

This is apparently a feature, not a bug.
up
11
anton at zebooka dot com
1 year ago
It seems that starting of PHP 5.4 you can not override class method with different signature.

Example:
<?php
class A
{
    public function
doSomething($a, $b)
    {
    }
}

class
B extends A
{
    public function
doSomething($c)
    {
    }
}
?>

PHP Strict standards:  Declaration of B::doSomething() should be compatible with A::doSomething(B $a) in Command line code on line 1
up
27
Chris
2 years ago
Missing some chars like german umlauts after use of htmlspecialchars? That's because the third param encoding has changed it's default value in PHP 5.4 from ISO-8859-1 to UTF-8.

Possible solution #1:
Change your code from this ...
<?php htmlspecialchars( 'äöü' ); ?>
... to this:
<?php htmlspecialchars ( 'äöü' , ENT_COMPAT | ENT_HTML401 , 'ISO-8859-1' ); ?>

Possible solution #2:
Create a wrapper function and replace htmlspecialchars( to i.e. isohtmlspecialchars( with your IDE/editor/shell...

Example of a wrapper function:
<?php
function isohtmlspecialchars( $str ){
   return
htmlspecialchars ( $str , ENT_COMPAT | ENT_HTML401 , 'ISO-8859-1' );
}
?>
up
1
contact at nouslisons dot com
1 month ago
Be careful, in php 5.4. \e in string mean the escape character !
So you will have error for windows path:
$a = "c:\extend\toto.txt";

AND for date function:
echo date ("\t\h\e dmy");
you will have an escape character in your source instead "e"

The workaround I found is simple quote:
echo date ('\t\h\e dmy');
up
-4
luis at portanel dot com
2 years ago
It's not a PHP version incompatibility itself, but it's important to know that Microsoft dropped the php_mssql.dll support for the "mssql_" funcitions since this version.

To connect to a MSSQL database since 5.4, one good alternative are the PDO drivers.
up
-4
the dot mail dot bg at gmail dot com
1 year ago
There should be samples given here. There are many ways to do such coversion:

Converting an array to a string will now generate an E_NOTICE level error, but the result of the cast will still be the string "Array".
up
-38
blagdan at gmail dot com
1 year ago
'<?if'... worked in 5.3 as equivalent of '<?php if'... In 5.4 it's converted to '<!--?if'...
To Top