LOVDnl / LOVD3

LOVD3 development repository
http://www.LOVD.nl
GNU General Public License v3.0
24 stars 4 forks source link

Found two typos in the code; empty() not run on variables but on a boolean and a static string. #593

Closed angsm closed 2 years ago

angsm commented 2 years ago

Closing to inactivity. If this is still an issue for you, please let me know.

Originally posted by @ifokkema in https://github.com/LOVDnl/LOVD3/issues/579#issuecomment-1024326499

Hi,

I actually managed to edit the code a little in 2 files to make master branch code work on my installation, would you like to review the changes? Not sure if it changes function in the code, but there might be misplace of brackets in inc-lib-variants.php and missing function in variants.php.

Changes as below:

[angsm@gis-dlap83v LOVD3]$ git diff --staged diff --git a/src/inc-lib-variants.php b/src/inc-lib-variants.php index 68cc4c1..503ae30 100644 --- a/src/inc-lib-variants.php +++ b/src/inc-lib-variants.php @@ -228,10 +228,10 @@ function lovd_fixHGVS ($sVariant, $sType = '') return lovd_fixHGVS($sReference . $sType . substr($sVariant, 1), $sType); }

-- } elseif (!empty($aVariant['errors'] ++ } elseif (!empty($aVariant['errors']) && !isset($aVariant['errors']['ESUFFIXMISSING']) && !isset($aVariant['errors']['EPOSITIONFORMAT']) -- && isset($aVariant['warnings']['WTOOMUCHUNKNOWN']))) { ++ && isset($aVariant['warnings']['WTOOMUCHUNKNOWN'])) { return $sReference . $sVariant; // Not HGVS. }

diff --git a/src/variants.php b/src/variants.php index a568da6..f90fcba 100644 --- a/src/variants.php +++ b/src/variants.php @@ -188,7 +188,7 @@ if (!ACTION && (empty($_PE[1])

if (PATH_COUNT == 2 && $_PE[1] == 'in_gene' && !ACTION -- && (!(LOVD_plus || LOVD_light) || (!empty($_GET['search_geneid']) && !empty('search_VariantOnTranscript/DNA')))) { ++ && (!(LOVD_plus || LOVD_light) || (!empty($_GET['search_geneid']) && !empty($_GET['search_VariantOnTranscript/DNA'])))) { // URL: /variants/in_gene // View all entries effecting a transcript.

ifokkema commented 2 years ago

Thanks for this! Especially the second one has been in there for quite some time, but never caused any issues - it would with "LOVD light" or "LOVD+", which are two forks of LOVD. The first one is relatively recent. I guess there is indeed no real difference in functionality as long as empty() accepts non-variable input. I guess your PHP version's empty() doesn't like non-variable input. I don't see any information on recent changes in the empty() function. What PHP version are you running?