#16504 closed enhancement (invalid)
Faster maybe_unserialize
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.1 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
In #14429 many have taken care to optimize the is_serialized speed.
The function is of good general value and most often used to "maybe" unserialize.
It was originally smabauers who reminded that it's only about to check what it's about to check.
Option values, if serialized are only serialized Array, Objects or Strings. No exceptions. And they are always trimmed strings.
As is_serialized() is of general use and might be used by plugin authors, maybe_unserialize can get a new playmate.
Attachments (1)
Change History (13)
#2
follow-up:
↓ 3
@
14 years ago
Option values, if serialized are only serialized Array, Objects or Strings. No exceptions. And they are always trimmed strings.
This is an incorrect assumption - the API allows you to provide already serialised data if you want.
#3
in reply to:
↑ 2
;
follow-up:
↓ 4
@
14 years ago
Replying to westi:
Option values, if serialized are only serialized Array, Objects or Strings. No exceptions. And they are always trimmed strings.
This is an incorrect assumption - the API allows you to provide already serialised data if you want.
Well that's what for the "or Strings" part of my sentence is about. You must have just missed it, my sentence is very correct indeed.
#4
in reply to:
↑ 3
;
follow-up:
↓ 5
@
14 years ago
Replying to hakre:
Replying to westi:
Option values, if serialized are only serialized Array, Objects or Strings. No exceptions. And they are always trimmed strings.
This is an incorrect assumption - the API allows you to provide already serialised data if you want.
Well that's what for the "or Strings" part of my sentence is about. You must have just missed it, my sentence is very correct indeed.
No it's not - what about serialized integers?
#5
in reply to:
↑ 4
;
follow-up:
↓ 6
@
14 years ago
Replying to westi:
Replying to hakre:
Option values, if serialized are only serialized Array, Objects or Strings. No exceptions. [...]
No it's not - what about serialized integers?
I've created a table in my post Serialization in Options: Cant see the Wood for the Trees that handles each data case and tells whether it is serialized in options or not. It's the first table.
The "Option Values" I talk about are those that come from the database, not those that are returned by get_option()
. That function will always return the unserialized value, in case of your serialized integer, the serialized integer.
If you look into the code of the patch, it becomes clear about what functions this is about.
Does this helps to better understand?
#6
in reply to:
↑ 5
;
follow-up:
↓ 7
@
14 years ago
Replying to hakre:
Replying to westi:
Replying to hakre:
Option values, if serialized are only serialized Array, Objects or Strings. No exceptions. [...]
No it's not - what about serialized integers?
I've created a table in my post Serialization in Options: Cant see the Wood for the Trees that handles each data case and tells whether it is serialized in options or not. It's the first table.
The "Option Values" I talk about are those that come from the database, not those that are returned by
get_option()
. That function will always return the unserialized value, in case of your serialized integer, the serialized integer.
If you look into the code of the patch, it becomes clear about what functions this is about.
Does this helps to better understand?
Not really.
You are still making an assumption: You are assuming that the only place maybe_unserialize is ever used is for unserializing things which have been maybe_serialized - you are changing it's behaviour by not supporting all types of serialized data.
It has had this behaviour since WordPress 2.0 - we are not going to break it!
#7
in reply to:
↑ 6
@
14 years ago
Replying to westi:
You are still making an assumption: You are assuming that the only place maybe_unserialize is ever used is for unserializing things which have been maybe_serialized - you are changing it's behaviour by not supporting all types of serialized data.
That's no argument against the enhancement itself. If maybe_unserialize is not the right place for that enhancement, it's easy to find that right place.
It has had this behaviour since WordPress 2.0 - we are not going to break it!
I never said I want to break it, keep cool.
#9
@
11 years ago
- Resolution set to wontfix
- Status changed from new to closed
If this is still an issue please reopen and be prepared with unit tests to support. See comment:6
introducing is_serialized_maybe