Note: Module tests as working so far.

There is one warning in a test which is not critical.

The ldap_servers.functions.inc has a possible ERROR, in case anyone has encountered it.

ldap/ldap_servers/ldap_servers.functions.inc
--------------------------------------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 2 LINES
--------------------------------------------------------------------------------------------------
18 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
18 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
18 | ERROR | "$this" can no longer be used in a plain function or method since PHP 7.1.
429 | ERROR | preg_replace() - /e modifier is deprecated since PHP 5.5 and removed since PHP 7.0
--------------------------------------------------------------------------------------------------

For the above inside
function ldap_user_modify($dn, $attributes, $ldap_server) {

Line 18:
$tokens = ['%dn' => $dn, '%sid' => $this->sid, '%ldap_errno' => ldap_errno($this->connection), '%ldap_err2str' => ldap_err2str(ldap_errno($this->connection))];

however also says:
* This has been depracated(sic) in favor or $ldap_server->modifyLdapEntry($dn, $attributes)
* which handles empty attributes better.

And the warning in the test

ldap/ldap_test/LdapTestCase.class.php
------------------------------------------------------------------------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
------------------------------------------------------------------------------------------------------------------------------------
141 | WARNING | Since PHP 7.0, functions inspecting arguments, like debug_backtrace(), no longer report the original value as
| | passed to a parameter, but will instead provide the current value. The parameter "$description" was used, and
| | possibly changed (by reference), on line 131.
------------------------------------------------------------------------------------------------------------------------------------

Comments

darrell_ulm created an issue. See original summary.

darrell_ulm’s picture

Issue summary: View changes
grahl’s picture

Patches are welcome

darrell_ulm’s picture

StatusFileSize
new971 bytes

Here is a patch for the first part, which is a similar to how the watchdog message was setup in a previous version of the function.

The warnings for warning in the test file appear to be a false positive.

darrell_ulm’s picture

Status: Active » Needs review
grahl’s picture

Status: Needs review » Needs work

While I like that the arguments are collated with the request, I'd prefer if we just switch out $this->connection with the available information in $ldap_server->connection and remvoe the other $this variable.

I'm fine with adding the values but would appreciate if the error would get added back in.

P.S.: An "Error: " prefix is not a common usage in other modules when the message is already marked as a watchdog error.

darrell_ulm’s picture

Good points, thanks! I'll re-roll this =when= time permits.

solideogloria’s picture

Status: Needs work » Needs review
StatusFileSize
new1.36 KB

I made changes according to #6. I also updated the comment to show it is @deprecated.

I did think about this, maybe you could just change the function contents to return $ldap_server->modifyLdapEntry($dn, $attributes); instead?

Note that I didn't test this code.

solideogloria’s picture

StatusFileSize
new1.88 KB

I removed the code causing the error 429 | ERROR | preg_replace(). The PHP version check and /e flag are no longer needed. The module info file specifies php = 5.4, so anyone using anything lower will probably already have issues.

  • grahl committed 2d0d115 on 7.x-2.x authored by solideogloria
    Issue #3073824 by solideogloria, darrellulm@gmail.com: PHP 7.2 PHPCS...
grahl’s picture

Status: Needs review » Fixed

Thanks for the updated patch, committed.

Even though we might be able to simplify as comment #8 indicates, ldap-7.x is EOL so we'll only add fixes for critical bugs or upgrade regressions.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.