svn: /phpdoc/en/trunk/reference/var/functions/ is-callable.xml
| From: | Christoph Michael Becker | Date: | Sat, 25 Jun 2016 15:13:40 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/var/functions/ is-callable.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-14249@lists.php.net to get a copy of this message | ||
cmb Sat, 25 Jun 2016 15:13:40 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=339491
Log:
Fix #64221: is_callable() reports constructors as not callable
Bug: https://bugs.php.net/64221 (Verified) is_callable()
reports constructors as not callable
Changed paths:
U phpdoc/en/trunk/reference/var/functions/is-callable.xml
Modified: phpdoc/en/trunk/reference/var/functions/is-callable.xml
===================================================================
--- phpdoc/en/trunk/reference/var/functions/is-callable.xml 2016-06-25 14:42:12 UTC (rev 339490)
+++ phpdoc/en/trunk/reference/var/functions/is-callable.xml 2016-06-25 15:13:40 UTC (rev 339491)
@@ -121,6 +121,39 @@
]]>
</programlisting>
</example>
+ <example>
+ <title><function>is_callable</function> and constructors</title>
+ <simpara>
+ As of PHP 5.3.0 <function>is_callable</function> reports constructors as
+ not being callable. This affects PHP 5 style constructors
+ (<literal>__construct</literal>) as well as PHP 4 stlye constructors (i.e.
+ methods with the same name as the class). Formerly, both cases have been
+ considered callable.
+ </simpara>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+class Foo
+{
+ public function __construct() {}
+ public function foo() {}
+}
+
+var_dump(
+ is_callable(array('Foo', '__construct')),
+ is_callable(array('Foo', 'foo'))
+);
+]]>
+ </programlisting>
+ &example.outputs;
+ <screen>
+<![CDATA[
+bool(false)
+bool(false)
+]]>
+ </screen>
+ </example>
</para>
</refsect1>