1.2.1257. Unicode Escape Partial

PHP 7 introduces a new escape sequence for strings : u{hex}. It is backward incompatible with previous PHP versions for two reasons :

PHP 7 will recognize en replace those sequences, while PHP 5 keep them intact. PHP 7 will halt on partial Unicode Sequences, as it tries to understand them, but may fail. Is is recommended to check all those strings, and make sure they will behave correctly in PHP 7.

<?php

echo \u{1F418}\n;
// PHP 5 displays the same string
// PHP 7 displays : an elephant

echo \u{NOT A UNICODE CODEPOINT}\n;
// PHP 5 displays the same string
// PHP 7 emits a fatal error

?>

1.2.1257.1. Specs

Short name

Php/UnicodeEscapePartial

Rulesets

All, Changed Behavior, CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56

Exakat since

0.8.4

PHP Version

With PHP 7.0 and older

Severity

Major

Time To Fix

Quick (30 mins)

Changed Behavior

PHP 7.0 - More

Precision

Very high

Features

unicode, escape-sequence

Available in

Entreprise Edition, Exakat Cloud