Skip to content

Commit

Permalink
Example of null coalescing assignment operator.
Browse files Browse the repository at this point in the history
Craig, see if this works. 

$allow_view_other = ( ( $ALLOW_VIEW_OTHER ??= 'Y' ) === 'Y' );

if $ALLOW_VIEW_OTHER is undefined or null, assign 'Y'.
In this case the default from default_config.php. 
Then see if it's === 'Y'
  • Loading branch information
bbannon authored Oct 6, 2023
1 parent e014bec commit a5bd287
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion access.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
require_once 'includes/init.php';

$allow_view_other = ( $ALLOW_VIEW_OTHER === 'Y' );
$allow_view_other = ( ( $ALLOW_VIEW_OTHER ??= 'Y' ) === 'Y' );

if( ! access_is_enabled() ) {
echo print_not_auth();
Expand Down

0 comments on commit a5bd287

Please sign in to comment.