cvs: /phpdoc/functions ldap.sgml

From: Date: Fri, 10 Sep 1999 09:01:47 +0000
Subject: cvs: /phpdoc/functions ldap.sgml
Groups: php.dev 
Request: Send a blank email to php-dev+get-10793@lists.php.net to get a copy of this message
kk Fri Sep 10 05:01:47 1999 EDT Modified files: /phpdoc/functions ldap.sgml Log: Documented LDAP error handling functions. Index: phpdoc/functions/ldap.sgml diff -u phpdoc/functions/ldap.sgml:1.2 phpdoc/functions/ldap.sgml:1.3 --- phpdoc/functions/ldap.sgml:1.2 Sat Jun 19 23:04:56 1999 +++ phpdoc/functions/ldap.sgml Fri Sep 10 05:01:46 1999 @@ -1055,7 +1055,123 @@ </refsect1> </refentry> + <refentry id="function.ldap-err2str"> + <refnamediv> + <refname>ldap_err2str</refname> + <refpurpose>Convert LDAP error number into string error message</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcdef>string <function>ldap_err2str</function></funcdef> + <paramdef>int <parameter>errno</parameter></paramdef> + </funcsynopsis> + <para> + returns string error message. + <para> + This function returns the string error message explaining + the error number errno. While LDAP errno numbers are + standardized, different libraries return different or + even localized textual error messages. Never check for + a specific error message text, but always use an error + number to check. + <para> + see also <function>ldap_errno</function> and + <function>ldap_error</function>. + <example> + <title>Enumerating all LDAP error messages</title> +<programlisting role=php> +&lt;?php + for($i=0; $i<100; $i++) { + printf("Error $i: %s&lt;br>\n", ldap_str2err($i)); + } +?> +</programlisting> + </example> + </refsect1> + </refentry> + + <refentry id="function.ldap-errno"> + <refnamediv> + <refname>ldap_errno</refname> + <refpurpose>Return the LDAP error number of the last LDAP command</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcdef>int <function>ldap_errno</function></funcdef> + <paramdef>int <parameter>link_id</parameter></paramdef> + </funcsynopsis> + <para> + return the LDAP error number of the last LDAP command for this link. + <para> + This function returns the standardized error number + returned by the last LDAP command for the given link + identifier. This number can be converted into a textual + error message using <function>ldap_err2str</function>. + <para> + Unless you lower your warning level in your php3.ini sufficiently + or prefix your LDAP commands with @ (at) characters to suppress + warning output, the errors generated will also show up in your + HTML output. + <example> + <title>Generating and catching an error</title> +<programlisting role=php> +&lt;?php + // This example contains an error, which we will catch. + $ld = ldap_connect("localhost"); + $bind = ldap_bind($ld); + // syntax error in filter expression (errno 87), + // must be "objectclass=*" to work. + $res = @ldap_search($ld, "o=Myorg, c=DE", "objectclass"); + if (!$res) { + printf("LDAP-Errno: %s<br>\n", ldap_errno($ld)); + printf("LDAP-Error: %s<br>\n", ldap_error($ld)); + die("Argh!<br>\n"); + } + $info = ldap_get_entries($ld, $res); + printf("%d matching entries.<br>\n", $info["count"]); +?> +</programlisting> + </example> + <para> + see also <function>ldap_err2str</function> and + <function>ldap_error</function>. + </refsect1> + </refentry> + + <refentry id="function.ldap-error"> + <refnamediv> + <refname>ldap_error</refname> + <refpurpose>Return the LDAP error message of the last LDAP command</refpurpose> + </refnamediv> + <refsect1> + <title>Description</title> + <funcsynopsis> + <funcdef>string <function>ldap_error</function></funcdef> + <paramdef>int <parameter>link_id</parameter></paramdef> + </funcsynopsis> + <para> + returns string error message. + <para> + This function returns the string error message explaining + the error generated by the last LDAP command for the given + link identifier. While LDAP errno numbers are + standardized, different libraries return different or + even localized textual error messages. Never check for + a specific error message text, but always use an error + number to check. + <para> + Unless you lower your warning level in your php3.ini sufficiently + or prefix your LDAP commands with @ (at) characters to suppress + warning output, the errors generated will also show up in your + HTML output. + <para> + see also <function>ldap_err2str</function> and + <function>ldap_errno</function>. + </refsect1> + </refentry> </reference> <!-- Keep this comment at the end of the file

« previous php.dev (#10793) next »