2014-09-05 07:44:07 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 08:02:54 +00:00
|
|
|
<!-- $Revision$ -->
|
2007-06-20 22:25:43 +00:00
|
|
|
<refentry xml:id="function.php-check-syntax" xmlns="http://docbook.org/ns/docbook">
|
2004-05-02 15:47:00 +00:00
|
|
|
<refnamediv>
|
|
|
|
<refname>php_check_syntax</refname>
|
|
|
|
<refpurpose>
|
2005-01-25 20:00:24 +00:00
|
|
|
Check the PHP syntax of (and execute) the specified file
|
2004-05-02 15:47:00 +00:00
|
|
|
</refpurpose>
|
|
|
|
</refnamediv>
|
2005-01-25 20:00:24 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2004-05-02 15:47:00 +00:00
|
|
|
<methodsynopsis>
|
|
|
|
<type>bool</type><methodname>php_check_syntax</methodname>
|
2007-02-19 00:04:49 +00:00
|
|
|
<methodparam><type>string</type><parameter>filename</parameter></methodparam>
|
2004-11-10 08:30:50 +00:00
|
|
|
<methodparam choice="opt"><type>string</type><parameter role="reference">error_message</parameter></methodparam>
|
2004-05-02 15:47:00 +00:00
|
|
|
</methodsynopsis>
|
2007-02-19 00:04:49 +00:00
|
|
|
<para>
|
|
|
|
Performs a syntax (lint) check on the specified
|
|
|
|
<parameter>filename</parameter> testing for scripting errors.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
This is similar to using <command>php -l</command> from the <link
|
|
|
|
linkend="features.commandline">commandline</link> except that this
|
|
|
|
function will execute (but not output) the checked
|
|
|
|
<parameter>filename</parameter>.
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
For example, if a function is defined in <parameter>filename</parameter>,
|
|
|
|
this defined function will be available to the file that executed
|
2005-01-25 20:00:24 +00:00
|
|
|
<function>php_check_syntax</function>, but output from
|
2007-02-19 00:04:49 +00:00
|
|
|
<parameter>filename</parameter> will be suppressed.
|
|
|
|
</para>
|
|
|
|
<note>
|
2005-01-25 20:00:24 +00:00
|
|
|
<!-- See PHP bug #27406 for details on this suppression -->
|
2007-02-19 00:04:49 +00:00
|
|
|
<para>
|
|
|
|
For technical reasons, this function is deprecated and removed from PHP.
|
|
|
|
Instead, use <literal>php -l somefile.php</literal> from the
|
|
|
|
<link linkend="features.commandline">commandline</link>.
|
|
|
|
</para>
|
|
|
|
</note>
|
2005-01-25 20:00:24 +00:00
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2005-01-25 20:00:24 +00:00
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
|
|
|
<para>
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2007-02-19 00:04:49 +00:00
|
|
|
<term><parameter>filename</parameter></term>
|
2005-01-25 20:00:24 +00:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of the file being checked.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
<varlistentry>
|
|
|
|
<term><parameter>error_message</parameter></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
If the <parameter>error_message</parameter> parameter is used, it will
|
|
|
|
contain the error message generated by the syntax check.
|
|
|
|
<parameter>error_message</parameter> is passed by
|
|
|
|
<link linkend="language.references">reference</link>.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2005-01-25 20:00:24 +00:00
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
|
|
|
Returns &true; if the lint check passed, and &false; if the link check
|
2007-02-19 00:04:49 +00:00
|
|
|
failed or if <parameter>filename</parameter> cannot be opened.
|
2005-01-25 20:00:24 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2005-01-25 20:00:24 +00:00
|
|
|
<refsect1 role="changelog">
|
|
|
|
&reftitle.changelog;
|
|
|
|
<para>
|
|
|
|
<informaltable>
|
|
|
|
<tgroup cols="2">
|
|
|
|
<thead>
|
|
|
|
<row>
|
|
|
|
<entry>&Version;</entry>
|
|
|
|
<entry>&Description;</entry>
|
|
|
|
</row>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
2005-04-04 20:26:08 +00:00
|
|
|
<row>
|
2005-04-07 04:05:47 +00:00
|
|
|
<entry>5.0.5</entry>
|
2005-04-04 20:26:08 +00:00
|
|
|
<entry>
|
|
|
|
This function was removed from PHP.
|
|
|
|
</entry>
|
|
|
|
</row>
|
2005-01-25 20:00:24 +00:00
|
|
|
<row>
|
|
|
|
<entry>5.0.3</entry>
|
|
|
|
<entry>
|
2012-04-15 21:45:34 +00:00
|
|
|
Calling <function>exit</function> after
|
2005-01-25 20:00:24 +00:00
|
|
|
<function>php_check_syntax</function> resulted in a Segfault.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
<row>
|
|
|
|
<entry>5.0.1</entry>
|
|
|
|
<entry>
|
|
|
|
<parameter>error_message</parameter> is passed by reference.
|
|
|
|
</entry>
|
|
|
|
</row>
|
|
|
|
</tbody>
|
|
|
|
</tgroup>
|
|
|
|
</informaltable>
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2005-01-25 20:00:24 +00:00
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
|
|
|
<para>
|
2005-04-04 20:26:08 +00:00
|
|
|
<screen>
|
2004-07-22 16:13:36 +00:00
|
|
|
<![CDATA[
|
2005-04-04 20:26:08 +00:00
|
|
|
php -l somefile.php
|
2004-07-22 16:13:36 +00:00
|
|
|
]]>
|
2005-04-04 20:26:08 +00:00
|
|
|
</screen>
|
|
|
|
</para>
|
|
|
|
&example.outputs.similar;
|
|
|
|
<para>
|
|
|
|
<screen>
|
2004-07-22 16:13:36 +00:00
|
|
|
<![CDATA[
|
2005-04-04 20:26:08 +00:00
|
|
|
PHP Parse error: unexpected T_STRING in /tmp/somefile.php on line 81
|
2004-07-22 16:13:36 +00:00
|
|
|
]]>
|
2005-04-04 20:26:08 +00:00
|
|
|
</screen>
|
2005-01-25 20:00:24 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2005-01-25 20:00:24 +00:00
|
|
|
<refsect1 role="seealso">
|
|
|
|
&reftitle.seealso;
|
|
|
|
<para>
|
|
|
|
<simplelist>
|
2012-04-15 21:45:34 +00:00
|
|
|
<member><function>include</function></member>
|
2005-01-25 20:00:24 +00:00
|
|
|
<member><function>is_readable</function></member>
|
|
|
|
</simplelist>
|
|
|
|
</para>
|
2004-05-02 15:47:00 +00:00
|
|
|
</refsect1>
|
2007-02-19 00:04:49 +00:00
|
|
|
|
2004-05-02 15:47:00 +00:00
|
|
|
</refentry>
|
|
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
Local variables:
|
|
|
|
mode: sgml
|
|
|
|
sgml-omittag:t
|
|
|
|
sgml-shorttag:t
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
sgml-indent-step:1
|
|
|
|
sgml-indent-data:t
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
sgml-parent-document:nil
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2004-05-02 15:47:00 +00:00
|
|
|
sgml-exposed-tags:nil
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
End:
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
-->
|