-
Notifications
You must be signed in to change notification settings - Fork 8k
[php7.0] bugfix for #68406 #74940 #2683
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
Conversation
c86515c to
a02a690
Compare
ext/date/php_date.c
Outdated
| return FAILURE; | ||
| } | ||
| if (SUCCESS == timezone_initialize(*tzobj, Z_STRVAL_P(z_timezone), Z_STRLEN_P(z_timezone))) { | ||
| printf("testtest\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume this shouldn't be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tpunt oh sorry, it seems I forget to push my latest commit...
8e2e17b to
98ccb51
Compare
|
Please do open PR(s) for the other branches ... |
|
@jhdxr @krakjoe seems like |
| return props; | ||
| } /* }}} */ | ||
|
|
||
| static inline void date_object_update_properties_timezone(zval *object) /* {{{ */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just for clarification - you decided to create new inline function just to have more obvious function name, am I right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. IMHO I'd like to rewrite these parts of code, since I think get_properties should do retrieve only, updating data inside should have been forbidden. but it's really a huge project, and modifying a code which still can work is not a good idea, so I just leave them alone.
|
I haven't read the patch in detail, only done triage ... if other patches are needed, they need to exist before merge can happen is all I'm saying at this point ... |
|
@andrewnester I guess the |
|
@krakjoe ok, I'll ping you after I've provided all the necessary patches. |
|
@jhdxr not sure that |
|
zend_throw_error throws an Error exception. You're probably thinking about zend_error, which is kinda similar to php_error_docref (but well, without the "docref" part). In any case, none of those are deprecated. |
|
@derickr Are any properties supposed to be exposed on DateTimeZone or is this just the usual get_properties side effect? If DateTimeZone is not intended to expose properties, then the proper way to fix the comparison issue is by implementing a comparison handler. |
|
@nikic I took implementing In fact, there are lots of issues on bugs.php.net of date extension which are caused by the same reason, |
This patch doesn't solve that though, it just ignores it. Now it will use the default object property comparison semantics, which most likely will not result in any sensible behavior. The "standard" way of handling non-trichotomous comparisons in PHP to is always return "greater" for non-equal comparisons. Together with the fact that the "$a > $b" comparison is defined as "$b < $a", this means that all non-equality comparisons return false. This is not perfect, but the only possibility we really have right now.
Indeed. This is a long standing issue caused by the lack of specific object handlers for serialization (and in the case of DateTime objects, unfortunately also var_exporting). |
I suggest to add this to https://wiki.php.net/internals/engine/objects#compare_objects. I cannot find an implementation meeting all the requirements, so I just use the default handler. And yes, I know it doesn't make sense for DateTimeZone.
This is a point people usually used to blame php. IMHO, we should put our priority on standards. If we had a standard of the internal namespace, the arguments that sodium should use namespace or not wouldn't happen. In addtion, it also bring the possibilty to standlize and clean up the existed functions. There are many things we can do without BC break. Back to the issue here, I can use |
|
@nikic These properties should only be exposed through the debug handler. As they are read only and meant for debugging only. |
|
@jhdxr Greater than should probably done on:
And then depending on type:
|
|
@derickr ok. I'll create a new pr to fix 68406 by implementing anyway, I'm closing #2685 and #2686, and leave this one open for discussion. |
|
#2766 stil isn't merged. And just spent an hour finding out this is also a problem in DateInterval and DatePeriod: DateInterval: https://3v4l.org/3FaWi And already forgot about this issue... |
|
abandoned |
this PR update the properties of DateTimeZone immediately after the object created. this should solve #68406 and #74940
btw, I found this patch cannot apply to php 7.1 or above and master, since
php_error_docrefhas been replaced withzend_throw_errorin those branches. I'm not sure if I need to open a new PR targeting php 7.1 for this problem.