|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2017-01-11 04:48 UTC] krakjoe@php.net
-Assigned To:
+Assigned To: derick
[2021-02-15 13:22 UTC] cmb@php.net
-Status: Assigned
+Status: Not a bug
-Assigned To: derick
+Assigned To: cmb
[2021-02-15 13:22 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 07:00:01 2025 UTC |
Description: ------------ the casing of the mongodb functions is inconsistent with the MongoDB classes I know php is not case sensitive when it comes comes to namespaces however comparing string does raise issues and mixing namespace casings like this does not seem like a good practice. Test script: --------------- <pre> <?php print_r(array_values(array_filter(get_declared_classes(),function($var){ return strcasecmp(strstr($var,'\\',true) ,'mongodb') == 0; }))); print_r(array_values(array_filter(get_defined_functions()['internal'],function($var){ return strcasecmp(strstr($var,'\\',true) ,'mongodb') == 0; }))); ?> </pre> Expected result: ---------------- (the general opinion) Array ( [0] => MongoDB\BSON\Binary [1] => MongoDB\BSON\Decimal128 ... [31] => MongoDB\Driver\Exception\ExecutionTimeoutException [32] => MongoDB\Driver\Exception\ConnectionTimeoutException ) Array ( [0] => MongoDB\BSON\fromphp [1] => MongoDB\BSON\tophp [2] => MongoDB\BSON\tojson [3] => MongoDB\BSON\fromjson ) -- OR -- (personally I prefer camel-case/lower-case over studly-caps for namespaces (so you can see if its a namespace or class (in use statements for example))) Array ( [0] => mongodb\bson\Binary [1] => mongodb\bson\Decimal128 ... [31] => mongodb\driver\exception\ExecutionTimeoutException [32] => mongodb\driver\exception\ConnectionTimeoutException ) Array ( [0] => mongodb\bson\fromphp [1] => mongodb\bson\tophp [2] => mongodb\bson\tojson [3] => mongodb\bson\fromjson ) anyway I would expect them to match independent of the chosen casing Actual result: -------------- Array ( [0] => MongoDB\BSON\Binary [1] => MongoDB\BSON\Decimal128 ... [31] => MongoDB\Driver\Exception\ExecutionTimeoutException [32] => MongoDB\Driver\Exception\ConnectionTimeoutException ) Array ( [0] => mongodb\bson\fromphp [1] => mongodb\bson\tophp [2] => mongodb\bson\tojson [3] => mongodb\bson\fromjson )