Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in usage/uploadComplete.php: Duplicate Quote Replacement in Publisher Name Search #773

Open
snorri opened this issue Aug 28, 2024 · 0 comments
Labels
bug This is a bug (not an enhancement) Next release Propose for February release

Comments

@snorri
Copy link

snorri commented Aug 28, 2024

Description: When searching for a publisher in the Publisher table, the publisher name search string that includes quotes has the quotes replaced twice in the SQL query—once in uploadComplete.php and once in Publisher.php.

Details:

  • In uploadComplete.php:
$searchName = trim(str_replace ("'","''",$name));
$publisher = $publisher->getByName($searchName); 
  • In Publisher.php:
public function getByName($publisherName){
   $query = "select publisherID from Publisher where upper(name) = upper('" . str_replace("'","''", $publisherName) . "') LIMIT 1;";

Issue: This double replacement of quotes causes publisher names that include quotes to never match an existing entry in the Publisher table, resulting in duplicate rows being created.

Suggested Solution: Remove one of the str_replace calls. Additionally, consider using prepared statements to avoid these replacements and improve security.

@streatim streatim added bug This is a bug (not an enhancement) Next release Propose for February release labels Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is a bug (not an enhancement) Next release Propose for February release
Projects
None yet
Development

No branches or pull requests

2 participants