Sophie

Sophie

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

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>Checking for E_STRICT</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="migration51.databases.html">Changes in database support</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="migration5.html">Migrating from PHP 4 to PHP 5.0.x</a></div>
 <div class="up"><a href="migration51.html">Migrating from PHP 5.0.x to PHP 5.1.x</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="migration51.errorcheck" class="section">
  <h2 class="title">Checking for <strong><code>E_STRICT</code></strong></h2>
  <div class="informalexample">
   <p class="para">
    If you only have a single script to check, you can pick up
    <strong><code>E_STRICT</code></strong> errors using PHP&#039;s commandline lint
    facility:
   </p>
   <div class="example-contents"><div class="shellcode"><pre class="shellcode">php -d error_reporting=4095 -l script_to_check.php</pre>
</div></div>

   <p class="para">
    For larger projects, the shell script below will achieve the same task:
   </p>
   <div class="example-contents">
<div class="shellcode"><pre class="shellcode">#!/bin/sh

directory=$1

shift

# These extensions are checked
extensions=&quot;php inc&quot;

check_file ()
{
  echo -ne &quot;Doing PHP syntax check on $1 ...&quot;

  # Options:
  ERRORS=`/www/php/bin/php -d display_errors=1 -d html_errors=0 -d error_prepend_string=&quot; &quot; -d error_append_string=&quot; &quot; -d error_reporting=4095 -l $1 | grep -v &quot;No syntax errors detected&quot;`

  if test -z &quot;$ERRORS&quot;; then
    echo -ne &quot;OK.&quot;
  else
    echo -e &quot;Errors found!\n$ERRORS&quot;
  fi

  echo
}

# loop over remaining file args
for FILE in &quot;$@&quot; ; do
  for ext in $extensions; do
     if echo $FILE | grep &quot;\.$ext$&quot; &gt; /dev/null; then
       if test -f $FILE; then
         check_file &quot;$FILE&quot;
       fi
     fi
  done
done</pre>
</div>
   </div>

  </div>
 </div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="migration51.databases.html">Changes in database support</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="migration5.html">Migrating from PHP 4 to PHP 5.0.x</a></div>
 <div class="up"><a href="migration51.html">Migrating from PHP 5.0.x to PHP 5.1.x</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>