Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 9253

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Backward Incompatible Changes</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="migration52.changes.html">What has changed in PHP 5.2.x</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="migration52.error-messages.html">New Error Messages</a></div>
 <div class="up"><a href="migration52.html">Migrating from PHP 5.1.x to PHP 5.2.x</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="migration52.incompatible" class="section">
  <h2 class="title">Backward Incompatible Changes</h2>
  <p class="para">
   Although most existing PHP 5 code should work without changes, you should
   pay attention to the following backward incompatible changes:
  </p>
  <ul class="itemizedlist">
   <li class="listitem">
    <span class="simpara">
      <span class="function"><a href="function.getrusage.html" class="function">getrusage()</a></span> returns <strong><code>NULL</code></strong> when passed
     incompatible arguments as of PHP 5.2.1.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
      <span class="function"><a href="ziparchive.setcommentname.html" class="function">ZipArchive::setCommentName()</a></span>
     returns <strong><code>TRUE</code></strong> on success as of PHP 5.2.1.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
      <span class="function"><a href="ziparchive.setcommentindex.html" class="function">ZipArchive::setCommentIndex()</a></span>
     returns <strong><code>TRUE</code></strong> on success as of PHP 5.2.1.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
      <span class="function"><strong>SplFileObject::getFilename()</strong></span> returns
     the filename, not relative/path/to/file, as of PHP 5.2.1.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     Changed priority of <var class="varname"><var class="varname">PHPRC</var></var> environment variable on Win32
    </span>
    <span class="simpara">
     The <var class="varname"><var class="varname">PHPRC</var></var> environment variable now takes priority over the path stored
     in the Windows registry.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     CLI SAPI no longer checks cwd for <var class="filename">php.ini</var> or the <var class="filename">php-cli.ini</var> file
    </span>
    <span class="simpara">
     In PHP 5.1.x an undocumented feature was added that made the CLI binary check
     the current working directory for a PHP configuration file, potentially
     leading to unpredictable behavior if an unexpected configuration file were
     read. This functionality was removed in 5.2.0, and PHP will no longer search
     CWD for the presence of <var class="filename">php.ini</var> or <var class="filename">php-cli.ini</var> files.
     See also the <a href="features.commandline.html" class="link">command line</a> section
     of the manual.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     Added a warning when performing modulus 0 operations
    </span>
    <span class="simpara">
     In earlier versions of PHP, performing integer % 0 did not emit any
     warning messages, instead returning an unexpected return value of <strong><code>FALSE</code></strong>.
     As of PHP 5.2.0, this operation will emit an <strong><code>E_WARNING</code></strong>, 
     as is the case in all other instances where division by zero is performed.
    </span>
    <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">print&nbsp;</span><span style="color: #0000BB">10&nbsp;</span><span style="color: #007700">%&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;Warning:&nbsp;&nbsp;Division&nbsp;by&nbsp;zero&nbsp;in&nbsp;filename&nbsp;on&nbsp;line&nbsp;n&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </li>
   <li class="listitem">
    <span class="simpara">
     Changed <a href="language.oop5.magic.html#object.tostring" class="link">__toString()</a> to be called wherever
     applicable.
    </span>
    <span class="simpara">
     The magic method <a href="language.oop5.magic.html#object.tostring" class="link">__toString()</a> will now be called
     in a string context, that is, anywhere an object is used as a
     string.
    </span>
    <span class="simpara">
     The fallback of returning a string that contains the
     object identifier was dropped in PHP 5.2.0.  It became
     problematic because an object identifier cannot be considered
     unique. This change will mean that your application is flawed if you
     have relied on the object identifier as a return value.  An attempt
     to use that value as a string will now result in a catchable fatal
     error.
    </span>
    <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&nbsp;</span><span style="color: #0000BB">foo&nbsp;</span><span style="color: #007700">{}<br /></span><span style="color: #0000BB">$foo&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">;<br />print&nbsp;</span><span style="color: #0000BB">$foo</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;Catchable&nbsp;fatal&nbsp;error:&nbsp;&nbsp;Object&nbsp;of&nbsp;class&nbsp;foo&nbsp;could<br />&nbsp;&nbsp;&nbsp;not&nbsp;be&nbsp;converted&nbsp;to&nbsp;string&nbsp;in&nbsp;filename&nbsp;on&nbsp;line&nbsp;n&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
    <span class="simpara">
     Even with <a href="language.oop5.magic.html#object.tostring" class="link">__toString()</a>, objects cannot be used as
     array indices or keys. We may add built-in hash support for this at
     a later date, but as of PHP 5.2.x you will need to either provide your
     own hashing or use the new SPL function
      <span class="function"><a href="function.spl-object-hash.html" class="function">spl_object_hash()</a></span>.
    </span>
    <span class="simpara">
     Exceptions can not be thrown from
     <a href="language.oop5.magic.html#object.tostring" class="link">__toString()</a> methods.
    </span>
    <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&nbsp;</span><span style="color: #0000BB">foo&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;public&nbsp;function&nbsp;</span><span style="color: #0000BB">__toString</span><span style="color: #007700">()&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;throw&nbsp;new&nbsp;</span><span style="color: #0000BB">Exception</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /><br />try&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;print&nbsp;new&nbsp;</span><span style="color: #0000BB">foo</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Fatal&nbsp;error:&nbsp;&nbsp;Method&nbsp;foo::__toString()&nbsp;must<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not&nbsp;throw&nbsp;an&nbsp;exception&nbsp;in&nbsp;filename&nbsp;on&nbsp;line&nbsp;n&nbsp;*/<br /></span><span style="color: #007700">}&nbsp;catch(</span><span style="color: #0000BB">Exception&nbsp;$e</span><span style="color: #007700">)&nbsp;{}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </li>
   <li class="listitem">
    <span class="simpara">
     Dropped abstract static class functions.
    </span>
    <span class="simpara">
     Due to an oversight, PHP 5.0.x and 5.1.x allowed abstract static 
     functions in classes. As of PHP 5.2.x, only interfaces can have them.
    </span>
    <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">abstract&nbsp;class&nbsp;</span><span style="color: #0000BB">foo&nbsp;</span><span style="color: #007700">{<br />&nbsp;&nbsp;&nbsp;&nbsp;abstract&nbsp;static&nbsp;function&nbsp;</span><span style="color: #0000BB">bar</span><span style="color: #007700">();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">/*&nbsp;Strict&nbsp;Standards:&nbsp;&nbsp;Static&nbsp;function&nbsp;foo::bar()<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;should&nbsp;not&nbsp;be&nbsp;abstract&nbsp;in&nbsp;filename&nbsp;on&nbsp;line&nbsp;n&nbsp;*/<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </li>
   <li class="listitem">
    <span class="simpara">
     <a href="ref.oci8.html" class="link">Oracle extension</a> requires at least Oracle
     10 on Windows.
    </span>
   </li>
   <li class="listitem">
    <span class="simpara">
     Added RFC2397 (<em>data:</em> stream) support.
    </span>
    <span class="simpara">
     The introduction of the &#039;data&#039; URL scheme has the potential to lead to a
     change of behavior under Windows. If you are working with a <acronym>NTFS</acronym>
     file system and making use of meta streams in your application, and if you
     just happen to be using a file with the name &#039;data:&#039; that is accessed without
     any path information - it won&#039;t work any more. The fix is to use the &#039;file:&#039;
     protocol when accessing it.
    </span>
    <span class="simpara">
     See also <a href="http://www.faqs.org/rfcs/rfc2397" class="link external">&raquo;&nbsp;RFC 2397</a> 
    </span>
    <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">/*&nbsp;when&nbsp;allow_url_include&nbsp;is&nbsp;OFF&nbsp;(default)&nbsp;*/<br /></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">"data:;base64,PD9waHAgcGhwaW5mbygpOz8+"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/*&nbsp;Warning:&nbsp;&nbsp;include():&nbsp;URL&nbsp;file-access&nbsp;is&nbsp;disabled<br />&nbsp;&nbsp;&nbsp;in&nbsp;the&nbsp;server&nbsp;configuration&nbsp;in&nbsp;filename&nbsp;on&nbsp;line&nbsp;n&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
     </div>

    </div>
   </li>
   <li class="listitem">
    <span class="simpara">
     Regression in <em>glob()</em> patterns
    </span>
    <span class="simpara">
     In version 5.2.4 a security fix caused a regression for patterns of
     the form &quot;/foo/*/bar/*&quot;. Since version 5.2.5 instead of raising a warning the
     <em>glob()</em> function will return <strong><code>FALSE</code></strong> when
     <em>openbase_dir</em> restrictions are violated.
    </span>
   </li>
  </ul>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="migration52.changes.html">What has changed in PHP 5.2.x</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="migration52.error-messages.html">New Error Messages</a></div>
 <div class="up"><a href="migration52.html">Migrating from PHP 5.1.x to PHP 5.2.x</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>