php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69555 [DE] unpredictable results with array_udiff example
Submitted: 2015-04-30 19:35 UTC Modified: 2015-04-30 23:22 UTC
From: buero at wehrstedt dot com Assigned: cmb (profile)
Status: Closed Package: Translation problem
PHP Version: 5.4Git-2015-04-30 (Git) OS: XAMPP
Private report: No CVE-ID: None
 [2015-04-30 19:35 UTC] buero at wehrstedt dot com
Description:
------------
---
From manual page: http://www.php.net/function.array-udiff
---

I tried out the example shown with function array_udiff. The example sets a property in the cr class, the compare function compares boolena instead of numerical.

I tried this example; as soon as I changed to $a == $b instead of $a === $b, I've got the results I exspected.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-30 20:13 UTC] cmb@php.net
-Status: Open +Status: Feedback -Type: Bug +Type: Documentation Problem -Package: Website problem +Package: Arrays related -Assigned To: +Assigned To: cmb
 [2015-04-30 20:13 UTC] cmb@php.net
To which example are you referring to? Example#2 uses $a == $b,
what is correct, because DateTime instances are compared.
 [2015-04-30 22:13 UTC] buero at wehrstedt dot com
-Status: Feedback +Status: Assigned
 [2015-04-30 22:13 UTC] buero at wehrstedt dot com
In the German Manual, there is no example #2, there is just one.

I meant this:

function comp_func_cr($a, $b) 
    {
        if ($a->priv_member === $b->priv_member) return 0;
        return ($a->priv_member > $b->priv_member)? 1:-1;
    }
 [2015-04-30 22:47 UTC] cmb@php.net
-Summary: unpredictable results with array_udiff example +Summary: [DE] unpredictable results with array_udiff example -Package: Arrays related +Package: Translation problem
 [2015-04-30 22:47 UTC] cmb@php.net
Ah, I see, thanks! The German translation of the array_udiff manual
page is currently not up-to-date, and the example violates strict
standards, so I suggest to ignore it. I'll update the translation
ASAP.
 [2015-04-30 23:20 UTC] cmb@php.net
Automatic comment from SVN on behalf of cmb
Revision: http://svn.php.net/viewvc/?view=revision&revision=336706
Log: fixed #69555
 [2015-04-30 23:22 UTC] cmb@php.net
-Status: Assigned +Status: Closed
 [2015-04-30 23:22 UTC] cmb@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.


 [2020-02-07 09:56 UTC] phpdocbot@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/de.git;a=commit;h=2c951f4f0238cea162ccf33b4c2322ac2a1452f9
Log: fixed #69555
 [2020-12-30 11:15 UTC] nikic@php.net
Automatic comment on behalf of cmb
Revision: http://git.php.net/?p=doc/de.git;a=commit;h=09a64bddae06258a49344d098e317190ad8c3bb6
Log: fixed #69555
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Nov 29 10:03:14 2021 UTC