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

Attachment opening not working #2915

Closed
RemBdev opened this issue Apr 15, 2024 · 5 comments
Closed

Attachment opening not working #2915

RemBdev opened this issue Apr 15, 2024 · 5 comments
Assignees
Labels
Milestone

Comments

@RemBdev
Copy link

RemBdev commented Apr 15, 2024

Describe the bug

When requesting an attachment, t he content is an white empty page. The log contains the following:

<h1>phpMyFAQ Fatal error</h1><p>Uncaught exception: 'Error'</p><p>Message: 'Typed property phpMyFAQ&bsol;Attachment&bsol;AttachmentAbstract&colon;&colon;&dollar;recordId must not be accessed before initialization'</p><p>Stack trace:<pre>#0 /var/www/html/attachment.php(54): phpMyFAQ\Attachment\AttachmentAbstract->getRecordId()
#1 /var/www/html/index.php(797): require('/var/www/html/a...')
#2 {main}</pre></p><p>Thrown in '/var/www/html/src/phpMyFAQ/Attachment/AttachmentAbstract.php' on line 218</p>

To Reproduce
Steps to reproduce the behavior:

  1. Go to an attachement like /index.php?action=attachment&id=39

Expected behavior
I would like to see the attachement

phpMyFAQ (please complete the following information):

  • phpMyFAQ version 3.2.6
  • PHP version 8.4
  • Database mysql
  • Elasticsearch no

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser Chrome

Additional context
Add any other context about the problem here.

@thorsten thorsten self-assigned this Apr 15, 2024
@thorsten thorsten added the Bug label Apr 15, 2024
@thorsten thorsten added this to the 3.2.7 milestone Apr 15, 2024
@RemBdev
Copy link
Author

RemBdev commented Apr 16, 2024

Hi @thorsten thanks for fixing. Now i have this issue, and still don't see the attachment:

<h1>phpMyFAQ Fatal error</h1><p>Uncaught exception: 'TypeError'</p><p>Message: 'phpMyFAQ&bsol;Attachment&bsol;AttachmentAbstract&colon;&colon;getRecordId&lpar;&rpar;&colon; Return value must be of type int&comma; null returned'</p><p>Stack trace:<pre>#0 /var/www/html/attachment.php(54): phpMyFAQ\Attachment\AttachmentAbstract->getRecordId()
#1 /var/www/html/index.php(797): require('/var/www/html/a...')

Also when entering an ID in the url that is not existing you get a dirty error:

phpMyFAQ Fatal error
Uncaught exception: 'TypeError'

Message: 'phpMyFAQ\Attachment\AttachmentAbstract::getRecordId(): Return value must be of type int, null returned'

Stack trace:

#0 /var/www/html/attachment.php(54): phpMyFAQ\Attachment\AttachmentAbstract->getRecordId()
#1 /var/www/html/index.php(797): require('/var/www/html/a...')
#2 {main}
Thrown in '/var/www/html/src/phpMyFAQ/Attachment/AttachmentAbstract.php' on line 218

The response is still not showing.

@thorsten
Copy link
Owner

@RemBdev Do you see a database entry in the table faqattachments for the given ID on the attachment page?

@RemBdev
Copy link
Author

RemBdev commented Apr 16, 2024

@thorsten

For the first error i see a record:
image

For the second error i entered on purpuse a non existing id.

@RemBdev
Copy link
Author

RemBdev commented May 14, 2024

Hi @thorsten ,

When we try to upload a file with your fixes we get now the following error:

Fatal error: Uncaught exception: 'Error'
Message: 'Typed property phpMyFAQ\Attachment\AttachmentAbstract::$id must not be accessed before initialization'
Stack trace:
#0 /var/www/html/src/phpMyFAQ/Attachment/File.php(101): phpMyFAQ\Attachment\AttachmentAbstract->saveMeta()
#1 /var/www/html/admin/api/attachment.php(90): phpMyFAQ\Attachment\File->save('/tmp/phpFRsCwe', 'VEK_MNH_Gebruik...')
#2 /var/www/html/admin/index.php(246): require('/var/www/html/a...')
#3 {main}

Is this difficult to fix?

Best regards!

@thorsten thorsten reopened this May 18, 2024
@thorsten
Copy link
Owner

This commit should fix your issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants