<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/migration70.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'de',
  ),
  'this' => 
  array (
    0 => 'migration70.incompatible.php',
    1 => 'Nicht abw&auml;rtskompatible &Auml;nderungen',
    2 => 'Nicht abw&auml;rtskompatible &Auml;nderungen',
  ),
  'up' => 
  array (
    0 => 'migration70.php',
    1 => 'Migration von PHP 5.6.x nach PHP 7.0.x',
  ),
  'prev' => 
  array (
    0 => 'migration70.php',
    1 => 'Migration von PHP 5.6.x nach PHP 7.0.x',
  ),
  'next' => 
  array (
    0 => 'migration70.new-features.php',
    1 => 'Neue Features',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'de',
    'path' => 'appendices/migration70/incompatible.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="migration70.incompatible" class="sect1">
 <h2 class="title">Nicht abwärtskompatible Änderungen</h2>

 



<div class="sect2" id="migration70.incompatible.error-handling">
 <h3 class="title">Änderungen im Umgang mit Fehlern und Exceptions</h3>

 <p class="para">
  Viele schwerwiegende und wiederherstellbare schwerwiegende Fehler wurden in
  PHP 7 in Exceptions umgewandelt. Diese Fehler-Exceptions erben von der
  Klasse <span class="classname"><a href="class.error.php" class="classname">Error</a></span>, die ihrerseits die Schnittstelle
  <span class="classname"><a href="class.throwable.php" class="classname">Throwable</a></span> implementiert (die neue Basisschnittstelle,
  die alle Exceptions erben).
 </p>

 <p class="para">
  Das bedeutet, dass benutzerdefinierte Funktionen für die Fehlerbehandlung
  eventuell nicht mehr ausgelöst werden, da stattdessen Exceptions ausgelöst
  werden (was neue schwerwiegende Fehler für nicht abgefangene
  <span class="classname"><a href="class.error.php" class="classname">Error</a></span>-Exceptions verursacht).
 </p>

 <p class="para">
  Eine genauere Beschreibung der Funktionsweise von Fehlern in PHP 7 ist auf
  der Seite <a href="language.errors.php7.php" class="link">Fehler in PHP 7</a> zu
  finden. Dieser Migrationsleitfaden zählt lediglich die Änderungen auf, die
  die Abwärtskompatibilität betreffen.
 </p>

 <div class="sect3" id="migration70.incompatible.error-handling.set-exception-handler">
  <h4 class="title">
   Bei der Funktion <span class="function"><a href="function.set-exception-handler.php" class="function">set_exception_handler()</a></span> ist nicht mehr
   gewährleistet, dass sie <span class="classname"><a href="class.exception.php" class="classname">Exception</a></span>-Objekte erhält.
  </h4>

  <p class="para">
   Code, der einen Exception-Handler mit der Funktion
   <span class="function"><a href="function.set-exception-handler.php" class="function">set_exception_handler()</a></span> unter Verwendung einer
   Deklaration vom Typ <span class="classname"><a href="class.exception.php" class="classname">Exception</a></span> implementiert, führt
   zu einem fatalen Fehler, wenn ein <span class="classname"><a href="class.error.php" class="classname">Error</a></span>-Objekt
   ausgelöst wird.
  </p>

  <p class="para">
   Wenn der Handler sowohl mit PHP 5 als auch mit PHP 7 funktionieren soll,
   sollte die Typdeklaration aus dem Handler entfernt werden. Bei Code, der
   migriert wird, um nur unter PHP 7 zu funktionieren, genügt es stattdessen,
   die <span class="classname"><a href="class.exception.php" class="classname">Exception</a></span>-Typdeklaration durch
   <span class="classname"><a href="class.throwable.php" class="classname">Throwable</a></span> zu ersetzen.
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// PHP-Code, der nicht mehr funktioniert<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">handler</span><span style="color: #007700">(</span><span style="color: #0000BB">Exception $e</span><span style="color: #007700">) { </span><span style="color: #FF8000">/* ... */ </span><span style="color: #007700">}<br /></span><span style="color: #0000BB">set_exception_handler</span><span style="color: #007700">(</span><span style="color: #DD0000">'handler'</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// PHP 5 und 7 kompatibel<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">handler</span><span style="color: #007700">(</span><span style="color: #0000BB">$e</span><span style="color: #007700">) { </span><span style="color: #FF8000">/* ... */ </span><span style="color: #007700">}<br /><br /></span><span style="color: #FF8000">// Nur PHP 7<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">handler</span><span style="color: #007700">(</span><span style="color: #0000BB">Throwable $e</span><span style="color: #007700">) { </span><span style="color: #FF8000">/* ... */ </span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.error-handling.constructors">
  <h4 class="title">Interne Konstruktoren lösen bei Fehlern immer Exceptions aus</h4>

  <p class="para">
   Zuvor gaben einige interne Klassen <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> oder ein unbrauchbares Objekt
   zurück, wenn der Konstruktor fehlschlug. Alle internen Klassen lösen nun in
   einem solchen Fall eine <span class="classname"><a href="class.exception.php" class="classname">Exception</a></span> aus, so wie es die
   benutzerdefinierten Klassen bereits tun.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.error-handling.parse">
  <h4 class="title">Parser-Fehler lösen <span class="classname"><a href="class.parseerror.php" class="classname">ParseError</a></span> aus</h4>

  <p class="para">
   Parser-Fehler erzeugen nun ein <span class="classname"><a href="class.parseerror.php" class="classname">ParseError</a></span>-Objekt.
   Die Fehlerbehandlung für <span class="function"><a href="function.eval.php" class="function">eval()</a></span> sollte einen
   <a href="language.exceptions.php#language.exceptions.catch" class="link"><code class="literal">catch</code></a>-Block enthalten, der diesen Fehler behandeln kann.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.error-handling.strict">
  <h4 class="title">Änderungen des Schweregrads von E_STRICT-Meldungen</h4>

  <p class="para">
   Alle <strong><code><a href="errorfunc.constants.php#constant.e-strict">E_STRICT</a></code></strong>-Meldungen wurden neu eingestuft. Die
   Konstante <strong><code><a href="errorfunc.constants.php#constant.e-strict">E_STRICT</a></code></strong> wurde beibehalten, sodass Aufrufe
   wie <code class="literal">error_reporting(E_ALL|E_STRICT)</code> keinen Fehler
   verursachen.
  </p>
  <p class="para">
   <table class="doctable table">
    <caption><strong>Änderungen des Schweregrads von E_STRICT-Meldungen</strong></caption>
     
      <thead>
       <tr>
        <th>Situation</th>
        <th>Neue Stufe/Verhalten</th>
       </tr>

      </thead>

      <tbody class="tbody">
       <tr>
        <td>Indizierung durch eine Ressource</td>
        <td><strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong></td>
       </tr>

       <tr>
        <td>Abstrakte statische Methoden</td>
        <td>Hinweis entfernt, löst keinen Fehler aus</td>
       </tr>

       <tr>
        <td>&quot;Neudefinieren&quot; eines Konstruktors</td>
        <td>Hinweis entfernt, löst keinen Fehler aus</td>
       </tr>

       <tr>
        <td>Inkompatible Signaturen bei der Vererbung</td>
        <td><strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong></td>
       </tr>

       <tr>
        <td>Gleiche (kompatible) Eigenschaft in zwei verwendeten Traits</td>
        <td>Hinweis entfernt, löst keinen Fehler aus</td>
       </tr>

       <tr>
        <td>Nicht-statischer Zugriff auf eine statische Eigenschaft</td>
        <td><strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong></td>
       </tr>

       <tr>
        <td>Nur Variablen sollten per Referenz zugewiesen werden</td>
        <td><strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong></td>
       </tr>

       <tr>
        <td>Nur Variablen sollten per Referenz übergeben werden</td>
        <td><strong><code><a href="errorfunc.constants.php#constant.e-notice">E_NOTICE</a></code></strong></td>
       </tr>

       <tr>
        <td>Statischer Aufruf nicht-statischer Methoden</td>
        <td><strong><code><a href="errorfunc.constants.php#constant.e-deprecated">E_DEPRECATED</a></code></strong></td>
       </tr>

      </tbody>
     
    </table>

   </p>
 </div>
</div>



 



<div class="sect2" id="migration70.incompatible.variable-handling">
 <h3 class="title">Änderungen beim Umgang mit Variablen</h3>

 <p class="para">
  PHP 7 verwendet nun beim Parsen von Quelldateien einen abstrakten
  Syntaxbaum. Dies hat viele Verbesserungen an der Sprache ermöglicht, die
  zuvor aufgrund der Einschränkungen des Parsers in früheren PHP-Versionen
  nicht möglich waren. Allerdings hat das auch dazu geführt, dass einige
  Spezialfälle aus Gründen der Konsistenz entfernt wurden, was Brüche in der
  Abwärtskompatibilität zur Folge hat. Diese Fälle werden in diesem Abschnitt
  detailliert beschrieben.
 </p>

 <div class="sect3" id="migration70.incompatible.variable-handling.indirect">
  <h4 class="title">Änderungen beim Umgang mit indirekten Variablen, Eigenschaften und Methoden</h4>

  <p class="para">
   Der indirekte Zugriff auf Variablen, Eigenschaften und Methoden wird nun
   in strikter Reihenfolge von links nach rechts ausgewertet. In früheren
   Versionen war die Reihenfolge der Auswertung in einigen Fällen umgekehrt.
   Die folgende Tabelle zeigt, wie sich die Reihenfolge der Auswertung
   geändert hat.
  </p>

  <p class="para">
   <table class="doctable table">
    <caption><strong>Alte und neue Auswertung indirekter Ausdrücke</strong></caption>
    
     <thead>
      <tr>
       <th>Ausdruck</th>
       <th>Auswertung in PHP 5</th>
       <th>Auswertung in PHP 7</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>
        <code class="code">$$foo[&#039;bar&#039;][&#039;baz&#039;]</code>
       </td>
       <td>
        <code class="code">${$foo[&#039;bar&#039;][&#039;baz&#039;]}</code>
       </td>
       <td>
        <code class="code">($$foo)[&#039;bar&#039;][&#039;baz&#039;]</code>
       </td>
      </tr>

      <tr>
       <td>
        <code class="code">$foo-&gt;$bar[&#039;baz&#039;]</code>
       </td>
       <td>
        <code class="code">$foo-&gt;{$bar[&#039;baz&#039;]}</code>
       </td>
       <td>
        <code class="code">($foo-&gt;$bar)[&#039;baz&#039;]</code>
       </td>
      </tr>

      <tr>
       <td>
        <code class="code">$foo-&gt;$bar[&#039;baz&#039;]()</code>
       </td>
       <td>
        <code class="code">$foo-&gt;{$bar[&#039;baz&#039;]}()</code>
       </td>
       <td>
        <code class="code">($foo-&gt;$bar)[&#039;baz&#039;]()</code>
       </td>
      </tr>

      <tr>
       <td>
        <code class="code">Foo::$bar[&#039;baz&#039;]()</code>
       </td>
       <td>
        <code class="code">Foo::{$bar[&#039;baz&#039;]}()</code>
       </td>
       <td>
        <code class="code">(Foo::$bar)[&#039;baz&#039;]()</code>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>

  <p class="para">
   Code, der die alte Auswertungsreihenfolge von rechts nach links verwendet,
   muss mit geschweiften Klammern umgeschrieben werden, um explizit diese
   Auswertungsreihenfolge zu verwenden (siehe die obige mittlere Spalte).
   Dadurch wird der Code sowohl vorwärtskompatibel mit PHP 7.x als auch
   rückwärtskompatibel mit PHP 5.x.
  </p>

  <p class="para">
   Dies betrifft auch das Schlüsselwort <a href="language.variables.scope.php#language.variables.scope.global" class="link"><code class="literal">global</code></a>. Falls erforderlich, kann die
   Syntax mit den geschweiften Klammern verwendet werden, um das frühere
   Verhalten zu emulieren:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">f</span><span style="color: #007700">() {<br />    </span><span style="color: #FF8000">// Nur in PHP 5 gültig.<br />    </span><span style="color: #007700">global $</span><span style="color: #0000BB">$foo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar</span><span style="color: #007700">;<br /><br />    </span><span style="color: #FF8000">// In PHP 5 und 7 gültig.<br />    </span><span style="color: #007700">global ${</span><span style="color: #0000BB">$foo</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">bar</span><span style="color: #007700">};<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.variable-handling.list">
  <h4 class="title">Änderungen im Umgang mit der Funktion <span class="function"><a href="function.list.php" class="function">list()</a></span></h4>

  <div class="sect4" id="migration70.incompatible.variable-handling.list.order">
   <h5 class="title">
    <span class="function"><a href="function.list.php" class="function">list()</a></span> weist Variablen nicht mehr in umgekehrter
    Reihenfolge zu
   </h5>

   <p class="para">
    <span class="function"><a href="function.list.php" class="function">list()</a></span> weist den Variablen nun Werte in der Reihenfolge
    zu, in der sie definiert sind, und nicht mehr in umgekehrter Reihenfolge.
    Wie unten gezeigt, betrifft dies im Allgemeinen nur Fälle, in denen
    <span class="function"><a href="function.list.php" class="function">list()</a></span> in Verbindung mit dem Array-Operator
    <code class="code">[]</code> verwendet wird:
   </p>

   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">list(</span><span style="color: #0000BB">$a</span><span style="color: #007700">[], </span><span style="color: #0000BB">$a</span><span style="color: #007700">[], </span><span style="color: #0000BB">$a</span><span style="color: #007700">[]) = [</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(3) {
  [0]=&gt;
  int(3)
  [1]=&gt;
  int(2)
  [2]=&gt;
  int(1)
}
</pre></div>
    </div>
    <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
    <div class="example-contents screen">
<div class="cdata"><pre>
array(3) {
  [0]=&gt;
  int(1)
  [1]=&gt;
  int(2)
  [2]=&gt;
  int(3)
}
</pre></div>
    </div>
   </div>

   <p class="para">
    Im Allgemeinen ist es nicht empfehlenswert, sich auf die Reihenfolge zu
    verlassen, in der die Zuweisungen mit <span class="function"><a href="function.list.php" class="function">list()</a></span> erfolgen.
    Das ist ein Implementierungs-Detail, das sich in der Zukunft wieder ändern
    kann.
   </p>
  </div>

  <div class="sect4" id="migration70.incompatible.variable-handling.list.empty">
   <h5 class="title">Leere <span class="function"><a href="function.list.php" class="function">list()</a></span>-Zuweisungen wurden entfernt</h5>

   <p class="para">
    <span class="function"><a href="function.list.php" class="function">list()</a></span>-Konstrukte dürfen nicht mehr leer sein; die
    Folgenden sind nicht mehr erlaubt:
   </p>

   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">list() = </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br />list(,,) = </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br />list(</span><span style="color: #0000BB">$x</span><span style="color: #007700">, list(), </span><span style="color: #0000BB">$y</span><span style="color: #007700">) = </span><span style="color: #0000BB">$a</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </div>

  <div class="sect4" id="migration70.incompatible.variable-handling.list.string">
   <h5 class="title"><span class="function"><a href="function.list.php" class="function">list()</a></span> kann keine <span class="type"><a href="language.types.string.php" class="type String">String</a></span>s entpacken</h5>

   <p class="para">
    <span class="function"><a href="function.list.php" class="function">list()</a></span> kann Variablen vom Typ <span class="type"><a href="language.types.string.php" class="type string">string</a></span> nicht
    mehr entpacken. Stattdessen sollte <span class="function"><a href="function.str-split.php" class="function">str_split()</a></span>
    verwendet werden.
   </p>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.variable-handling.array-order">
  <h4 class="title">
   Änderung der Reihenfolge von Array-Elementen, die automatisch durch
   Zuweisung per Referenz erzeugt werden
  </h4>

  <p class="para">
   Die Reihenfolge der Elemente eines Arrays, die automatisch durch Zuweisung
   per Referenz erstellt werden, hat sich geändert. Zum Beispiel:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$array </span><span style="color: #007700">= [];<br /></span><span style="color: #0000BB">$array</span><span style="color: #007700">[</span><span style="color: #DD0000">"a"</span><span style="color: #007700">] =&amp; </span><span style="color: #0000BB">$array</span><span style="color: #007700">[</span><span style="color: #DD0000">"b"</span><span style="color: #007700">];<br /></span><span style="color: #0000BB">$array</span><span style="color: #007700">[</span><span style="color: #DD0000">"b"</span><span style="color: #007700">] = </span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(2) {
  [&quot;b&quot;]=&gt;
  &amp;int(1)
  [&quot;a&quot;]=&gt;
  &amp;int(1)
}
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
array(2) {
  [&quot;a&quot;]=&gt;
  &amp;int(1)
  [&quot;b&quot;]=&gt;
  &amp;int(1)
}
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.variable-handling.parentheses">
  <h4 class="title">Klammern um Funktionsparameter haben keinen Einfluss mehr auf das Verhalten</h4>

  <p class="para">
   Wenn in PHP 5 redundante Klammern um Funktionsparameter verwendet wurden,
   konnte die Warnung wegen strikter Standards unterdrückt werden, indem der
   Parameter per Referenz übergeben wurde. Nun wird die Warnung immer
   angezeigt.
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">getArray</span><span style="color: #007700">() {<br />    return [</span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">];<br />}<br /><br />function </span><span style="color: #0000BB">squareArray</span><span style="color: #007700">(array &amp;</span><span style="color: #0000BB">$a</span><span style="color: #007700">) {<br />    foreach (</span><span style="color: #0000BB">$a </span><span style="color: #007700">as &amp;</span><span style="color: #0000BB">$v</span><span style="color: #007700">) {<br />        </span><span style="color: #0000BB">$v </span><span style="color: #007700">**= </span><span style="color: #0000BB">2</span><span style="color: #007700">;<br />    }<br />}<br /><br /></span><span style="color: #FF8000">// Erzeugt in PHP 7 eine Warnung.<br /></span><span style="color: #0000BB">squareArray</span><span style="color: #007700">((</span><span style="color: #0000BB">getArray</span><span style="color: #007700">()));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Notice: Only variables should be passed by reference in /tmp/test.php on line 13
</pre></div>
   </div>
  </div>
 </div>
</div>



 



<div class="sect2" id="migration70.incompatible.foreach">
 <h3 class="title">Änderungen bei <a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a></h3>

 <p class="para">
  Am Verhalten der Kontrollstruktur <a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a> wurden kleinere Änderungen
  vorgenommen, die sich vor allem auf die Handhabung des internen
  Array-Zeigers und auf die Änderung des Arrays, über das iteriert wird,
  beziehen.
 </p>

 <div class="sect3" id="migration70.incompatible.foreach.array-pointer">
  <h4 class="title"><a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a> ändert den internen Array-Zeiger nicht mehr</h4>

  <p class="para">
   Vor PHP 7 wurde der interne Array-Zeiger verändert, während mit <a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a>
   über ein Array iteriert wurde. Dies ist nun, wie im folgenden Beispiel
   gezeigt wird, nicht mehr der Fall:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$array </span><span style="color: #007700">= [</span><span style="color: #0000BB">0</span><span style="color: #007700">, </span><span style="color: #0000BB">1</span><span style="color: #007700">, </span><span style="color: #0000BB">2</span><span style="color: #007700">];<br />foreach (</span><span style="color: #0000BB">$array </span><span style="color: #007700">as &amp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">current</span><span style="color: #007700">(</span><span style="color: #0000BB">$array</span><span style="color: #007700">));<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
int(1)
int(2)
bool(false)
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
int(0)
int(0)
int(0)
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.foreach.by-value">
  <h4 class="title"><a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a> iteriert bei Übergabe per Wert über eine Kopie des Arrays</h4>

  <p class="para">
   Wenn <a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a> im Standardmodus Pass-by-Value verwendet wird, arbeitet es
   nun mit einer Kopie des Arrays, über das iteriert wird, und nicht mit dem
   Array selbst. Das bedeutet, dass Änderungen, die während des Iterierens am
   Array vorgenommen werden, keine Auswirkungen auf die iterierten Werte haben.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.foreach.by-ref">
  <h4 class="title">Verbessertes Iterationsverhalten von <a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a> bei Übergabe per Referenz</h4>

  <p class="para">
   Bei der Iteration per Referenz kann <a href="control-structures.foreach.php" class="link"><code class="literal">foreach</code></a> Änderungen, die während des
   Iterierens am Array vorgenommen werden, nun besser verfolgen. Wenn zum
   Beispiel während des Iterierens etwas an das Array angehängt wird, führt
   das dazu, dass nun auch über die angehängten Werte iteriert wird:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$array </span><span style="color: #007700">= [</span><span style="color: #0000BB">0</span><span style="color: #007700">];<br />foreach (</span><span style="color: #0000BB">$array </span><span style="color: #007700">as &amp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$val</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$array</span><span style="color: #007700">[</span><span style="color: #0000BB">1</span><span style="color: #007700">] = </span><span style="color: #0000BB">1</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
int(0)
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
int(0)
int(1)
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.foreach.object">
  <h4 class="title">Iteration über nicht-<span class="classname"><a href="class.traversable.php" class="classname">Traversable</a></span> Objekte</h4>

  <p class="para">
   Die Iteration über Objekte, die <span class="classname"><a href="class.traversable.php" class="classname">Traversable</a></span> nicht
   implementieren, verhält sich nun genauso wie die Iteration über Arrays per
   Referenz. Dies führt dazu, dass das
   <a href="migration70.incompatible.php#migration70.incompatible.foreach.by-ref" class="link">verbesserte Verhalten, wenn sich ein Array während des Iterierens ändert</a>
   auch angewendet wird, wenn Eigenschaften zum Objekt hinzugefügt oder daraus
   entfernt werden.
  </p>
 </div>
</div>



 



<div class="sect2" id="migration70.incompatible.integers">
 <h3 class="title">Änderungen im Umgang mit dem Typ <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></h3>

 <div class="sect3" id="migration70.incompatible.integers.invalid-octals">
  <h4 class="title">Ungültige oktale Literale</h4>

  <p class="para">
   Bisher wurden oktale Literale, die ungültige Zahlen enthielten,
   stillschweigend abgeschnitten (<code class="literal">0128</code> wurde als
   <code class="literal">012</code> interpretiert). Nun verursacht ein ungültiges
   Oktal-Literal einen Parser-Fehler.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.integers.negative-bitshift">
  <h4 class="title">Negative Bitverschiebungen</h4>

  <p class="para">
   Bitweises Verschieben um negative Zahlen führt nun zu einem
   <span class="classname"><a href="class.arithmeticerror.php" class="classname">ArithmeticError</a></span>:
  </p>
  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">1 </span><span style="color: #007700">&gt;&gt; -</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

    <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
    <div class="example-contents screen">
<div class="cdata"><pre>
int(0)
</pre></div>
    </div>
    <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
    <div class="example-contents screen">
<div class="cdata"><pre>
Fatal error: Uncaught ArithmeticError: Bit shift by negative number in /tmp/test.php:2
Stack trace:
#0 {main}
  thrown in /tmp/test.php on line 2
</pre></div>
    </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.integers.out-of-range">
  <h4 class="title">Bitverschiebungen außerhalb des zulässigen Bereichs</h4>

  <p class="para">
   Bitweise Verschiebungen (in beide Richtungen) über die Bitbreite eines
   <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> ergeben immer 0. Bisher war das Verhalten solcher
   Verschiebungen von der Architektur abhängig.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.integers.div-by-zero">
  <h4 class="title">Änderungen bei der Division durch Null</h4>

  <p class="para">
   Wenn 0 beim Divisionsoperator (/) oder beim Modulusoperator (%) als Divisor
   verwendet wird, wurde bisher einen Fehler der Stufe E_WARNING ausgegeben
   und <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> zurückgegeben. Nun gibt der
   Divisionsoperator, wie in IEEE 754 festgelegt, eine Gleitkommazahl entweder
   als +INF, -INF oder NAN zurück. Der Modulusoperator gibt nun kein E_WARNING
   mehr aus, sondern löst stattdessen eine
   <span class="classname"><a href="class.divisionbyzeroerror.php" class="classname">DivisionByZeroError</a></span>-Exception aus.
  </p>
  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">/</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">/</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">%</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Warning: Division by zero in %s on line %d
bool(false)

Warning: Division by zero in %s on line %d
bool(false)

Warning: Division by zero in %s on line %d
bool(false)
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Warning: Division by zero in %s on line %d
float(INF)

Warning: Division by zero in %s on line %d
float(NAN)

PHP Fatal error:  Uncaught DivisionByZeroError: Modulo by zero in %s line %d
</pre></div>
   </div>
  </div>
 </div>
</div>



 




<div class="sect2" id="migration70.incompatible.strings">
 <h3 class="title">Änderungen im Umgang mit dem Typ <span class="type"><a href="language.types.string.php" class="type string">string</a></span></h3>

 <div class="sect3" id="migration70.incompatible.strings.hex">
  <h4 class="title">Hexadezimale Zeichenketten werden nicht mehr als numerisch betrachtet</h4>

  <p class="para">
   Zeichenketten, die hexadezimale Zahlen enthalten, gelten nicht mehr als
   numerisch. Zum Beispiel:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />var_dump</span><span style="color: #007700">(</span><span style="color: #DD0000">"0x123" </span><span style="color: #007700">== </span><span style="color: #DD0000">"291"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">is_numeric</span><span style="color: #007700">(</span><span style="color: #DD0000">"0x123"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #DD0000">"0xe" </span><span style="color: #007700">+ </span><span style="color: #DD0000">"0x1"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">substr</span><span style="color: #007700">(</span><span style="color: #DD0000">"foo"</span><span style="color: #007700">, </span><span style="color: #DD0000">"0x1"</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
bool(true)
bool(true)
int(15)
string(2) &quot;oo&quot;
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
bool(false)
bool(false)
int(0)

Notice: A non well formed numeric value encountered in /tmp/test.php on line 5
string(3) &quot;foo&quot;
</pre></div>
   </div>
  </div>

  <p class="para">
   <span class="function"><a href="function.filter-var.php" class="function">filter_var()</a></span> kann verwendet werden, um zu prüfen, ob ein
   <span class="type"><a href="language.types.string.php" class="type string">string</a></span> eine hexadezimale Zahl enthält, und auch zur Umwandlung einer
   Zeichenkette dieses Typs zu einem <span class="type"><a href="language.types.integer.php" class="type int">int</a></span>:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$str </span><span style="color: #007700">= </span><span style="color: #DD0000">"0xffff"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$int </span><span style="color: #007700">= </span><span style="color: #0000BB">filter_var</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_VALIDATE_INT</span><span style="color: #007700">, </span><span style="color: #0000BB">FILTER_FLAG_ALLOW_HEX</span><span style="color: #007700">);<br />if (</span><span style="color: #0000BB">false </span><span style="color: #007700">=== </span><span style="color: #0000BB">$int</span><span style="color: #007700">) {<br />    throw new </span><span style="color: #0000BB">Exception</span><span style="color: #007700">(</span><span style="color: #DD0000">"Ungültige Ganzzahl!"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$int</span><span style="color: #007700">); </span><span style="color: #FF8000">// int(65535)<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.strings.unicode-escapes">
  <h4 class="title"><code class="literal">\u{</code> kann zu Fehlern führen</h4>

  <p class="para">
   Mit der Einführung der neuen
   <a href="migration70.new-features.php#migration70.new-features.unicode-codepoint-escape-syntax" class="link">Unicode-Codepoint-Maskierungssyntax</a>
   verursachen Zeichenketten, die <code class="literal">\u{</code> gefolgt von einer
   ungültigen Sequenz enthalten, einen fatalen Fehler. Um dies zu vermeiden,
   sollte der führende Rückwärtsstrich maskiert werden.
  </p>
 </div>
</div>



 



<div class="sect2" id="migration70.incompatible.removed-functions">
 <h3 class="title">Entfernte Funktionen</h3>

 <div class="sect3" id="migration70.incompatible.removed-functions.call-user-method">
  <h4 class="title">
   <span class="function"><strong>call_user_method()</strong></span> und
   <span class="function"><strong>call_user_method_array()</strong></span>
  </h4>

  <p class="para">
   Diese Funktionen sind seit PHP 4.1.0 zugunsten von
   <span class="function"><a href="function.call-user-func.php" class="function">call_user_func()</a></span> und
   <span class="function"><a href="function.call-user-func-array.php" class="function">call_user_func_array()</a></span> veraltet. Alternativ dazu
   können auch die
   <a href="functions.variable-functions.php" class="link">Variablenfunktionen</a>
   und/oder der Operator
   <a href="functions.arguments.php#functions.variable-arg-list" class="link"><code class="literal">...</code></a>
   verwendet werden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.ereg">
  <h4 class="title">Alle ereg*-Funktionen</h4>
  <p class="para">
   Alle <code class="literal">ereg</code>-Funktionen wurden entfernt. Es wird empfohlen,
   stattdessen <a href="book.pcre.php" class="link">PCRE</a> zu verwenden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.mcrypt">
  <h4 class="title">Aliase bei <a href="book.mcrypt.php" class="link">mcrypt</a></h4>

  <p class="para">
   Die veraltete Funktion <span class="function"><strong>mcrypt_generic_end()</strong></span> wurde
   zugunsten von <span class="function"><a href="function.mcrypt-generic-deinit.php" class="function">mcrypt_generic_deinit()</a></span> entfernt.
  </p>

  <p class="para">
   Darüber hinaus wurden die veralteten Funktionen
   <span class="function"><strong>mcrypt_ecb()</strong></span> <span class="function"><strong>mcrypt_cbc()</strong></span>,
   <span class="function"><strong>mcrypt_cfb()</strong></span> und <span class="function"><strong>mcrypt_ofb()</strong></span>
   zugunsten von <span class="function"><a href="function.mcrypt-decrypt.php" class="function">mcrypt_decrypt()</a></span> in Kombination
   mit der entsprechenden
   <strong><code>MCRYPT_MODE_<span class="replaceable">*</span></code></strong>-Konstante
   entfernt.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.mysql">
  <h4 class="title">Alle ext/mysql-Funktionen</h4>
  <p class="para">
   Alle <a href="book.mysql.php" class="link">ext/mysql</a>-Funktionen wurden
   entfernt. Details zur Auswahl einer anderen MySQL-API sind unter
   <a href="mysqlinfo.api.choosing.php" class="link">Auswahl einer API</a> zu finden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.mssql">
  <h4 class="title">Alle ext/mssql-Funktionen</h4>
  <p class="para">
   Alle <code class="literal">ext/mssql</code>-Funktionen wurden entfernt.
   <ul class="simplelist">
    <li><a href="ref.pdo-sqlsrv.php" class="link">PDO_SQLSRV</a></li>
    <li><a href="ref.pdo-odbc.php" class="link">PDO_ODBC</a></li>
    <li><a href="book.sqlsrv.php" class="link">SQLSRV</a></li>
    <li><a href="book.uodbc.php" class="link">Unified ODBC API</a></li>
   </ul>
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.intl">
  <h4 class="title">Aliase bei <a href="book.intl.php" class="link">intl</a></h4>

  <p class="para">
   Die veralteten Aliase <span class="function"><strong>datefmt_set_timezone_id()</strong></span> und
   <span class="methodname"><strong>IntlDateFormatter::setTimeZoneID()</strong></span> wurden
   zugunsten von <span class="function"><a href="intldateformatter.settimezone.php" class="function">datefmt_set_timezone()</a></span> bzw.
   <span class="methodname"><a href="intldateformatter.settimezone.php" class="methodname">IntlDateFormatter::setTimeZone()</a></span> entfernt.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.magic-quotes">
  <h4 class="title"><span class="function"><strong>set_magic_quotes_runtime()</strong></span></h4>

  <p class="para">
   Die Funktion <span class="function"><strong>set_magic_quotes_runtime()</strong></span> und ihr Alias
   <span class="function"><strong>magic_quotes_runtime()</strong></span> wurden entfernt. Sie sind seit
   PHP 5.3.0 veraltet und praktisch nutzlos, seit in PHP 5.4.0 die magischen
   Anführungszeichen entfernt wurden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.set-socket-blocking">
  <h4 class="title"><span class="function"><strong>set_socket_blocking()</strong></span></h4>

  <p class="para">
   Der veraltete Alias <span class="function"><strong>set_socket_blocking()</strong></span> wurde
   zugunsten von <span class="function"><a href="function.stream-set-blocking.php" class="function">stream_set_blocking()</a></span> entfernt.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.dl">
  <h4 class="title"><span class="function"><a href="function.dl.php" class="function">dl()</a></span> in PHP-FPM</h4>

  <p class="para">
   Die Funktion <span class="function"><a href="function.dl.php" class="function">dl()</a></span> kann in PHP-FPM nicht mehr verwendet
   werden. In CLI und integrierten SAPIs ist sie weiterhin verfügbar.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-functions.gd">
  <h4 class="title"><a href="book.image.php" class="link">GD</a>-Type1-Funktionen</h4>

  <p class="para">
   Die PostScript-Type1-Schriftarten werden von der Erweiterung GD nicht mehr
   unterstützt. Infolgedessen wurden die folgenden Funktionen entfernt:
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepsbbox()</strong></span>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepsencodefont()</strong></span>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepsextendfont()</strong></span>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepsfreefont()</strong></span>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepsloadfont()</strong></span>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepsslantfont()</strong></span>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <span class="function"><strong>imagepstext()</strong></span>
    </span>
   </li>
  </ul>

  <p class="para">
   Es wird empfohlen, stattdessen die TrueType-Schriftarten und die damit
   verbundenen Funktionen zu verwenden.
  </p>
 </div>
</div>



 



<div class="sect2" id="migration70.incompatible.removed-ini-directives">
 <h3 class="title">Entfernte INI-Direktiven</h3>

 <div class="sect3" id="migration70.incompatible.removed-ini-directives.features">
  <h4 class="title">Entfernte Features</h4>

  <p class="para">
   Die folgenden INI-Direktiven wurden entfernt, da ihre zugehörigen
   Funktionen ebenfalls entfernt wurden:
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">always_populate_raw_post_data</code>
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     <code class="parameter">asp_tags</code>
    </span>
   </li>
  </ul>
 </div>

 <div class="sect3" id="migration70.incompatible.removed-ini-directives.xsl">
  <h4 class="title"><code class="parameter">xsl.security_prefs</code></h4>

  <p class="para">
   Die Direktive <code class="parameter">xsl.security_prefs</code> wurde entfernt.
   Stattdessen sollte die Methode
   <span class="methodname"><a href="xsltprocessor.setsecurityprefs.php" class="methodname">XsltProcessor::setSecurityPrefs()</a></span> aufgerufen werden,
   um die Sicherheitseinstellungen auf Basis einzelner Prozessoren zu steuern.
  </p>
 </div>
</div>



 



<div class="sect2" id="migration70.incompatible.other">
 <h3 class="title">Andere nicht abwärtskompatible Änderungen</h3>

 <div class="sect3" id="migration70.incompatible.other.new-by-ref">
  <h4 class="title">Neue Objekte können nicht per Referenz zugewiesen werden</h4>

  <p class="para">
   Es ist nicht mehr möglich, das Resultat einer <a href="language.oop5.basic.php#language.oop5.basic.new" class="link"><code class="literal">new</code></a>-Anweisung per Referenz
   einer Variablen zuzuweisen:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">C </span><span style="color: #007700">{}<br /></span><span style="color: #0000BB">$c </span><span style="color: #007700">=&amp; new </span><span style="color: #0000BB">C</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Deprecated: Assigning the return value of new by reference is deprecated in /tmp/test.php on line 3
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Parse error: syntax error, unexpected &#039;new&#039; (T_NEW) in /tmp/test.php on line 3
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.other.classes">
  <h4 class="title">Ungültige Klassen-, Schnittstellen- und Traitnamen</h4>

  <p class="para">
   Die folgenden Namen können nicht mehr zur Benennung von Klassen,
   Schnittstellen und Traits verwendet werden:
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.float.php" class="type float">float</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.string.php" class="type string">string</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span>
   </li>
   <li class="listitem">
    <span class="simpara"><strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong></span>
   </li>
   <li class="listitem">
    <span class="simpara"><strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong></span>
   </li>
  </ul>

  <p class="para">
   Darüber hinaus sollten auch die folgenden Namen nicht verwendet werden.
   Auch wenn sie in PHP 7.0 keinen Fehler erzeugen, sind sie für die
   zukünftige Verwendung reserviert und sollten als veraltet angesehen werden.
  </p>

  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.object.php" class="type object">object</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><span class="type"><a href="language.types.mixed.php" class="type mixed">mixed</a></span></span>
   </li>
   <li class="listitem">
    <span class="simpara"><span class="type">numeric</span></span>
   </li>
  </ul>
 </div>

 <div class="sect3" id="migration70.incompatible.other.php-tags">
  <h4 class="title">ASP- und Skript-Tags wurden entfernt</h4>

  <p class="para">
   Es ist nicht mehr möglich, ASP-ähnliche Tags oder Skript-Tags zu verwenden,
   um PHP-Code einzuschließen. Die folgenden Tags sind hiervon betroffen:
  </p>

  <table class="doctable table">
   <caption><strong>Entfernte ASP- und Skript-Tags</strong></caption>
   
    <thead>
     <tr>
      <th>Öffnendes Tag</th>
      <th>Schließendes Tag</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
      <td><code class="code">&lt;%</code></td>
      <td><code class="code">%&gt;</code></td>
     </tr>

     <tr>
      <td><code class="code">&lt;%=</code></td>
      <td><code class="code">%&gt;</code></td>
     </tr>

     <tr>
      <td><code class="code">&lt;script language=&quot;php&quot;&gt;</code></td>
      <td><code class="code">&lt;/script&gt;</code></td>
     </tr>

    </tbody>
   
  </table>

 </div>

 <div class="sect3" id="migration70.incompatible.other.incompatible-this">
  <h4 class="title">Aufrufe aus inkompatiblen Kontexten wurden entfernt</h4>

  <p class="para">
   Ein statischer Aufruf einer nicht-statischen Methode aus einem
   inkompatiblen Kontext war
   <a href="migration56.deprecated.php#migration56.deprecated.incompatible-context" class="link">bereits in PHP 5.6 veraltet</a>
   und führt nun dazu, dass die aufgerufene Methode eine undefinierte
   <code class="literal">$this</code>-Variable hat und einen Veraltet-Hinweis ausgibt.
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">A </span><span style="color: #007700">{<br />    public function </span><span style="color: #0000BB">test</span><span style="color: #007700">() { </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$this</span><span style="color: #007700">); }<br />}<br /><br /></span><span style="color: #FF8000">// Hinweis: Erweitert A NICHT<br /></span><span style="color: #007700">class </span><span style="color: #0000BB">B </span><span style="color: #007700">{<br />    public function </span><span style="color: #0000BB">callNonStaticMethodOfA</span><span style="color: #007700">() { </span><span style="color: #0000BB">A</span><span style="color: #007700">::</span><span style="color: #0000BB">test</span><span style="color: #007700">(); }<br />}<br /><br />(new </span><span style="color: #0000BB">B</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">callNonStaticMethodOfA</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5.6 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Deprecated: Non-static method A::test() should not be called statically, assuming $this from incompatible context in /tmp/test.php on line 8
object(B)#1 (0) {
}
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
Deprecated: Non-static method A::test() should not be called statically in /tmp/test.php on line 8

Notice: Undefined variable: this in /tmp/test.php on line 3
NULL
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.other.yield">
  <h4 class="title"><a href="language.generators.syntax.php#control-structures.yield" class="link"><code class="literal">yield</code></a> ist nun ein rechtsassoziativer Operator</h4>

  <p class="para">
   Das <a href="language.generators.syntax.php#control-structures.yield" class="link"><code class="literal">yield</code></a>-Konstrukt ist nun rechtsassoziativ (Auswertung von rechts nach
   links) und es werden keine Klammern mehr benötigt. In der Rangfolge liegt
   es nun zwischen <code class="literal">print</code> und <code class="literal">=&gt;</code>.
   Dadurch ändert sich das Verhalten wie folgt:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">echo yield -</span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">// Wurde zuvor interpretiert als<br /></span><span style="color: #007700">echo (yield) - </span><span style="color: #0000BB">1</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">// Und wird nun interpretiert als<br /></span><span style="color: #007700">echo yield (-</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br />yield </span><span style="color: #0000BB">$foo </span><span style="color: #007700">or die;<br /></span><span style="color: #FF8000">// Wurde zuvor interpretiert als<br /></span><span style="color: #007700">yield (</span><span style="color: #0000BB">$foo </span><span style="color: #007700">or die);<br /></span><span style="color: #FF8000">// Und wird nun interpretiert als<br /></span><span style="color: #007700">(yield </span><span style="color: #0000BB">$foo</span><span style="color: #007700">) or die;<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>

  <p class="para">
   Um Unklarheiten zu beseitigen, können Klammern verwendet werden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.func-parameters">
  <h4 class="title">Eine Funktion kann nicht mehrere Parameter mit demselben Namen haben</h4>

  <p class="para">
   Es ist nicht mehr möglich, in einer Funktion mehrere Parameter mit
   demselben Namen zu definieren. Zum Beispiel führt eine Funktion wie die
   folgende zu einem <strong><code><a href="errorfunc.constants.php#constant.e-compile-error">E_COMPILE_ERROR</a></code></strong>:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">$a</span><span style="color: #007700">, </span><span style="color: #0000BB">$b</span><span style="color: #007700">, </span><span style="color: #0000BB">$unused</span><span style="color: #007700">, </span><span style="color: #0000BB">$unused</span><span style="color: #007700">) {<br />    </span><span style="color: #FF8000">//<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.other.func-parameter-modified">
  <h4 class="title">Funktionen, die Parameter analysieren, melden den <em>aktuellen</em> Parameterwert</h4>

  <p class="para">
   Die Funktionen <span class="function"><a href="function.func-get-arg.php" class="function">func_get_arg()</a></span>,
   <span class="function"><a href="function.func-get-args.php" class="function">func_get_args()</a></span> und <span class="function"><a href="function.debug-backtrace.php" class="function">debug_backtrace()</a></span>
   und Backtraces bei Exceptions melden nicht mehr den ursprünglichen Wert,
   der an einen Parameter übergeben wurde, sondern stattdessen den aktuellen
   Wert (der möglicherweise geändert wurde).
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">$x</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">$x</span><span style="color: #007700">++;<br />    </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">func_get_arg</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">));<br />}<br /></span><span style="color: #0000BB">foo</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);</span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 5 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
1
</pre></div>
   </div>
   <p class="para">Das oben gezeigte Beispiel erzeugt mit PHP 7 folgende Ausgabe:</p>
   <div class="example-contents screen">
<div class="cdata"><pre>
2
</pre></div>
   </div>
  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.other.multiple-default">
  <h4 class="title">Switch-Anweisungen können nicht mehrere default-Blöcke haben</h4>

  <p class="para">
   Es ist nicht mehr möglich, zwei oder mehr default-Blöcke in einer
   switch-Anweisung zu definieren. Zum Beispiel löst die folgende
   switch-Anweisung einen <strong><code><a href="errorfunc.constants.php#constant.e-compile-error">E_COMPILE_ERROR</a></code></strong> aus:
  </p>

  <div class="informalexample">
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">switch (</span><span style="color: #0000BB">1</span><span style="color: #007700">) {<br />    default:<br />    break;<br />    default:<br />    break;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
 </div>

 <div class="sect3" id="migration70.incompatible.other.http-raw-post-data">
  <h4 class="title"><var class="varname">$HTTP_RAW_POST_DATA</var> wurde entfernt</h4>

  <p class="para">
   <var class="varname">$HTTP_RAW_POST_DATA</var> ist nicht mehr verfügbar.
   Stattdessen sollte der
   <a href="wrappers.php.php#wrappers.php.input" class="link"><code class="literal">php://input</code></a>-Stream
   verwendet werden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.ini-comments">
  <h4 class="title">In INI-Dateien wurden Kommentare im <code class="literal">#</code>-Format entfernt</h4>

  <p class="para">
   In INI-Dateien ist es nicht mehr möglich, Kommentare durch ein
   vorangestelltes <code class="literal">#</code> zu markieren. Stattdessen sollte
   ein <code class="literal">;</code> (Semikolon) verwendet werden. Diese Änderung gilt
   nicht nur für die <var class="filename">php.ini</var>, sondern auch für Dateien, die von
   <span class="function"><a href="function.parse-ini-file.php" class="function">parse_ini_file()</a></span> und
   <span class="function"><a href="function.parse-ini-string.php" class="function">parse_ini_string()</a></span> verarbeitet werden.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.json-to-jsond">
  <h4 class="title">Erweiterung JSON durch JSOND ersetzt</h4>

  <p class="para">
   Die Erweiterung JSON wurde durch JSOND ersetzt, was zu drei kleineren
   Beeinträchtigungen in der Abwärtskompatibilität führt. Erstens darf eine
   Zahl nicht mit einem Dezimalpunkt enden (d. h. <code class="literal">34.</code> muss
   entweder durch <code class="literal">34.0</code> oder <code class="literal">34</code> ersetzt
   werden). Zweitens darf bei Verwendung der wissenschaftlichen Notation der
   Exponent <code class="literal">e</code> nicht unmittelbar auf einen Dezimalpunkt
   folgen (d. h. <code class="literal">3.e3</code> muss entweder durch
   <code class="literal">3.0e3</code> oder <code class="literal">3e3</code> ersetzt werden). Und
   schließlich wird eine leere Zeichenkette nicht mehr als gültiges JSON
   angesehen.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.internal-function-failure-overflow">
  <h4 class="title">Interne Funktionen schlagen bei Überlauf fehl</h4>

  <p class="para">
   Bisher haben interne Funktionen Zahlen, die von Gleitkommazahlen in
   Ganzzahlen umgewandelt wurden, stillschweigend abgeschnitten, wenn die
   Gleitkommazahl zu groß war, um sie als Ganzzahl darzustellen. Nun wird ein
   Fehler der Stufe E_WARNING ausgegeben und <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> zurückgegeben.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.fixes-custom-session-handler">
  <h4 class="title">Korrekturen bei Rückgabewerten von benutzerdefinierten Session-Handlern</h4>

  <p class="para">
   Eine Prädikatsfunktion, die von einem benutzerdefinierten Session-Handler
   implementiert wird und entweder <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> oder <code class="literal">-1</code>
   zurückgibt, löst einen schwerwiegenden Fehler aus. Ist ein von dieser
   Funktion zurückgegebener Wert nicht boolesch, <code class="literal">-1</code> oder
   <code class="literal">0</code>, schlägt die Funktion fehl und löst einen Fehler der
   Stufe E_WARNING aus.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.sort-order">
  <h4 class="title">Sortierreihenfolge gleichwertiger Elemente</h4>
  <p class="para">
   Aufgrund von Verbesserungen des internen Sortieralgorithmus kann sich die
   Sortierreihenfolge von Elementen, die beim Vergleich als gleichwertig
   betrachtet werden, im Vergleich zu vorherigen Versionen ändern.
  </p>
  <blockquote class="note"><p><strong class="note">Hinweis</strong>: 
   <p class="para">
    Es wird davon abgeraten, sich auf die Reihenfolge der Elemente, die als
    gleichwertig betrachtet werden, zu verlassen; sie kann sich jederzeit
    ändern.
   </p>
  </p></blockquote>
 </div>

 <div class="sect3" id="migration70.incompatible.other.break-continue">
  <h4 class="title">Falsch platzierte break- und continue-Anweisungen</h4>
  <p class="para">
   <code class="literal">break</code>- und <code class="literal">continue</code>-Anweisungen
   außerhalb einer Schleife oder einer
   <code class="literal">switch</code>-Kontrollstruktur werden nun bei der Kompilierung
   erkannt, anstatt wie bisher zur Laufzeit, und lösen einen Fehler der Stufe
   <strong><code><a href="errorfunc.constants.php#constant.e-compile-error">E_COMPILE_ERROR</a></code></strong> aus.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.break-continue-constant">
  <h4 class="title">Konstante als break- und continue-Argument nicht erlaubt</h4>
  <p class="para">
   Die Anweisungen <code class="literal">break</code> und <code class="literal">continue</code>
   erlauben keine Konstanten mehr als Argument und lösen einen
   <strong><code><a href="errorfunc.constants.php#constant.e-compile-error">E_COMPILE_ERROR</a></code></strong> aus.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.mhash">
  <h4 class="title">Mhash ist keine Erweiterung mehr</h4>
  <p class="para">
   Die Erweiterung Mhash wurde vollständig in die Erweiterung
   <a href="book.hash.php" class="link">Hash</a> integriert. Daher ist es nicht mehr
   möglich, mit <span class="function"><a href="function.extension-loaded.php" class="function">extension_loaded()</a></span> zu erkennen, ob Mhash
   unterstützt wird. Stattdessen sollte <span class="function"><a href="function.function-exists.php" class="function">function_exists()</a></span>
   verwendet werden. Darüber hinaus wird Mhash nicht mehr von
   <span class="function"><a href="function.get-loaded-extensions.php" class="function">get_loaded_extensions()</a></span> und ähnlichen Funktionen
   gemeldet.
  </p>
 </div>

 <div class="sect3" id="migration70.incompatible.other.declare-ticks">
  <h4 class="title">declare(ticks)</h4>
  <p class="para">
   Die Directive
   <a href="control-structures.declare.php#control-structures.declare.ticks" class="link">declare(ticks)</a>
   wird nicht mehr in verschiedene Kompilierungseinheiten übertragen.
  </p>
 </div>
</div>



</div><?php manual_footer($setup); ?>