Skip to content

Conversation

abirw-zz
Copy link
Contributor

Should be searching for upload_fk=$upload_pk ($2 rather than $1)

Description

A blank $item (as is default) was causing: "SELECT * FROM $uploadtreeTableName WHERE uploadtree_pk = '' " in getSingleRow, as a primary key shouldn't be blank, this was causing the query to return nothing. This caused getSinglerow to return an empty array, which was then passed into createItemTreeBounds as uploadEntryData. As an empty array == false in php, this caused an exception to be thrown, and in turn causing the scan to fail - but not fatally, just with the following error message:

did not find uploadTreeId in uploadtree_astring(442) "#0 /usr/local/share/fossology/lib/php/Dao/UploadDao.php(94): Fossology\Lib\Dao\UploadDao->createItemTreeBounds(false, 'uploadtree_a') #1 /usr/local/lib/fossology/fo_nomos_license_list.php(145): Fossology\Lib\Dao\UploadDao->getItemTreeBounds(NULL, 'uploadtree_a') #2 /usr/local/lib/fossology/fo_nomos_license_list.php(171): GetLicenseList(NULL, '2', 0, '', 0) #3 /usr/local/lib/fossology/fo_wrapper(77): require('/usr/local/lib/...') #4 {main}"

I'm hoping that this simple edit should fix things.

Should be searching for upload_fk=$upload_pk ($2 rather than $1)
Copy link
Member

@maxhbr maxhbr left a comment

Choose a reason for hiding this comment

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

Invalid code change


if (empty($uploadtree_pk)) {
$uploadtreeRec = $dbManager->getSingleRow('SELECT uploadtree_pk FROM uploadtree WHERE parent IS NULL AND upload_fk=$1',
$uploadtreeRec = $dbManager->getSingleRow('SELECT uploadtree_pk FROM uploadtree WHERE parent IS NULL AND upload_fk=$2',
Copy link
Member

Choose a reason for hiding this comment

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

This prepared statement only gets one argument ($upload_pk in array($upload_pk)) and thus only $1 is defined and $2 would point to the second one, which is not present.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see, any suggestions on how to fix this particular problem?

@GMishx
Copy link
Member

GMishx commented Jan 31, 2020

Unable to reproduce error as empty/wrong upload_fk and uploadtree_pk are checked.

Please reopen if issue still persists.

@GMishx GMishx closed this Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants