Edit report at https://bugs.php.net/bug.php?id=73899&edit=1

 ID:                 73899
 Updated by:         c...@php.net
 Reported by:        raat1979 at gmail dot com
 Summary:            mongodb\bson\fromphp namespace cassing deviation
-Status:             Assigned
+Status:             Not a bug
 Type:               Bug
 Package:            mongodb
 Operating System:   linux (ubuntu)
 PHP Version:        7.0.14
-Assigned To:        derick
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Please report MongoDB related issues in the appropriate bug
tracker[1].

[1] <https://jira.mongodb.org/browse/PHPC>


Previous Comments:
------------------------------------------------------------------------
[2017-01-09 21:21:29] raat1979 at gmail dot com

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
)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=73899&edit=1

-- 
PECL development discussion Mailing List (https://pecl.php.net/)
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to