Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@johnsaigle
Copy link
Contributor

See #3878 for a better description.

@johnsaigle johnsaigle added Category: Cleanup PR or issue introducing/requiring at least one clean-up operation [branch] major labels Oct 31, 2018
function passwordAuthenticate(
string $username,
string $password,
bool $redirect = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should indicate @param bool|null in doc block

Copy link
Contributor Author

@johnsaigle johnsaigle Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked the PHP documentation and I don't think this parameter is actually nullable, it's just optional. I think it's the difference between a variable being equal to null and a variable being unset.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wright, when you give a default value (other than null), it is not null

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Objection lifted your honor. But Travis is still objecting.

Copy link
Contributor Author

@johnsaigle johnsaigle Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Leaving the below post up in case it helps someone else.


I'm not sure that I understand. What I'm saying is that this variable should never be null so I don't think the suggestion to add |null is correct. That change would make it seem like you are allowed to call the function like this:

passwordAuthenticate('user', 'pass', null);

But this will give an error.

You are allowed to do this:

passwordAuthenticate('user', 'pass');

but in this case $redirect is initially unset, not null. They're different in PHP. In this case the default argument will set it to a bool.

So there is no case where $redirect is allowed to be null (even though it is optional).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bool $redirect = null would have required
@param bool|null .... and
?bool $redirect = null

giving a default value of true make it never to be null

Copy link
Contributor

@PapillonMcGill PapillonMcGill Nov 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About Travis, it is just a note that Travis failed (possibly not related, I haven't check)

Sorry Travis hasn't finish working, not the same

@johnsaigle johnsaigle added the "Help! I don't understand Travis!" PR is having a beef with TRAVIS. Someone needs to help label Nov 5, 2018
@johnsaigle
Copy link
Contributor Author

For some reason this PR always times out on Travis although when I test it on my VM I have no trouble logging in. Any ideas?

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
Copy link
Contributor

@kongtiaowang kongtiaowang Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This declare causes the issue. If remove this line, it will pass the test.
https://belitsoft.com/php-development-services/php-7-review-new-features-scalar-type-declarations-and-return-type-declarations

Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string, null given in /app/php/libraries/SinglePointLogin.class.inc:447 Stack trace: #0 /app/php/libraries/SinglePointLogin.class.inc(447): DateTime->__construct(NULL) #1 /app/php/libraries/SinglePointLogin.class.inc(322): SinglePointLogin->disabledDueToInactivity('UnitTester', 365) #2 /app/php/libraries/SinglePointLogin.class.inc(204): SinglePointLogin->passwordAuthenticate('UnitTester', '4test4') #3 /app/php/libraries/NDB_Client.class.inc(161): SinglePointLogin->authenticate() #4 /app/htdocs/index.php(22): NDB_Client->initialize() #5 /app/htdocs/router.php(74): include_once('/app/htdocs/ind...') #6 {main} thrown in /app/php/libraries/SinglePointLogin.class.inc on line 447

Copy link
Contributor Author

@johnsaigle johnsaigle Nov 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I'll review the bug

@johnsaigle johnsaigle removed the "Help! I don't understand Travis!" PR is having a beef with TRAVIS. Someone needs to help label Nov 7, 2018
@driusan driusan merged commit 6191829 into aces:major Nov 12, 2018
@ridz1208 ridz1208 added this to the 21.0.0 milestone Dec 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Cleanup PR or issue introducing/requiring at least one clean-up operation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants