php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30847 Flawed Example in Manual
Submitted: 2004-11-20 02:01 UTC Modified: 2004-11-20 06:15 UTC
From: jed at jed dot bz Assigned: sean (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: *
Private report: No CVE-ID: None
 [2004-11-20 02:01 UTC] jed at jed dot bz
Description:
------------
http://us2.php.net/manual/en/migration5.incompatible.php

Example B-2, "An object with no properties is no longer considered "empty"" is incorrect. Who would I talk to about CVS access so I can fix this stuff?

This is a glaring mistake, since $t *definitely* contains an instance reference regardless of what the class contains.

Reproduce code:
---------------
Below.

Expected result:
----------------
<?php
class test { }
$t = new test();

var_dump(empty($t)); // echo bool(false)

if (!$t) {
   // Will NOT be executed
}
?> 


Actual result:
--------------
<?php
class test { }
$t = new test();

var_dump(empty($t)); // echo bool(false)

if (!$t) {
   // Will be executed
}
?>

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-11-20 06:15 UTC] sean@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

You'll see, below, that "empty" objects ARE, in fact, no longer empty(...).

I've fixed the example (removed the !), though.

As far as CVS goes, the php.net is clear on this, and the normal procedure is for an applicant to build up a little reputation, by supplying patches to phpdoc@lists.php.net, before applying. 

--
sean@iconoclast:~$ echo '<?php echo PHP_VERSION ."\n"; class Test{}; $t = new Test(); var_dump(empty($t)); echo "execute ". (!$t ? "yes" : "no") ."\n"; ?>' | php4 -q
4.1.2
bool(true)
execute yes
sean@iconoclast:~$ echo '<?php echo PHP_VERSION ."\n"; class Test{}; $t = new Test(); var_dump(empty($t)); echo "execute ". (!$t ? "yes" : "no") ."\n"; ?>' | php
5.0.2
bool(false)
execute no

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 21:01:29 2024 UTC