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

Exception caught in the wrong namespace #3192

Closed
emanuele45 opened this issue May 28, 2018 · 5 comments
Closed

Exception caught in the wrong namespace #3192

emanuele45 opened this issue May 28, 2018 · 5 comments
Milestone

Comments

@emanuele45
Copy link
Contributor

In /sources/ext/serialize.php the exception:

} catch(Exception $e) {

is in the "wrong" namespace and so it's not caught at all.
to avoid changing the code, I'd just add:

use \Exception;

after the namespace declaration (that was anyway added by me).

@emanuele45 emanuele45 added this to the 1.1.4 milestone May 28, 2018
@Spuds
Copy link
Contributor

Spuds commented May 28, 2018

Cool ... that prevents it dying on a fatal error in serialize

The additonal issue on that site is that the db value is a string so unserialize fails (as it should), but then $modSettings['attachmentUploadDir'] is empty (and not an array) so the system fails on a fatal error in manageattachments.subs when it gets to foreach ($modSettings['attachmentUploadDir'] as $id => $dir)

I'm not sure if the db value was supposed to be array serialized in the upgrade or we are mishandling the value when it is a string and not a serialized array.

@emanuele45
Copy link
Contributor Author

In theory the attachments directory code was already "protected" by empty unserialize due to all the fallbacks to the single-directory structure from pre-SMF2.0, unless something is gone in the meantime... 😇

@Spuds
Copy link
Contributor

Spuds commented May 28, 2018

If I put a string in the db it bombs but I'm not sure if thats even possible anyway shrugs

@emanuele45
Copy link
Contributor Author

/me adds streamlining of attachments handling among the priorities for 2.0. 👼

@Spuds
Copy link
Contributor

Spuds commented May 28, 2018

That code is such a disaster, and so hard to "reuse" from addons (like the attachment resize one I have, what a PITA to get it working). I'm going to redo the graphic subs as well, another disastrous chunk of code.

Spuds added a commit to Spuds/Elkarte that referenced this issue May 28, 2018
@Spuds Spuds closed this as completed May 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants