Skip to content
This repository has been archived by the owner on Dec 16, 2019. It is now read-only.

Updates for PHP 7.3 #882

Merged
merged 9 commits into from
Jan 13, 2019
Merged

Updates for PHP 7.3 #882

merged 9 commits into from
Jan 13, 2019

Conversation

dktapps
Copy link
Contributor

@dktapps dktapps commented Jul 15, 2018

This is mostly just fixing issues inserting persistent strings into non-persistent hashtables. In some cases I have replaced them with interned strings, others just needed copying appropriately.

There are also fixes for iteration.

There is a BC break in the behaviour of Volatile object keys which I believe is caused by php/php-src#3351. I haven't taken the time to try and fix this yet.

Copy link
Collaborator

@sirsnyder sirsnyder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just added two small additions via one commit

@@ -54,7 +56,7 @@ object(Threaded)#%d (%d) {
}
}
}
[0]=>
["0"]=>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sirsnyder are you sure we want to ignore this instead of correcting it? It is a BC break after all.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dktapps nope, my fault. I assumed this would be the new and intended behavior of php arrays. But it's not, will have a look at it.

@sirsnyder
Copy link
Collaborator

sirsnyder commented Sep 29, 2018

@dktapps the last commit brings pthreads back to be consistent with php 73 (and 72) arrays, at least I hope so ;-) Do you see any issues with the fix? This could also be a possible solution for #560

@dktapps
Copy link
Contributor Author

dktapps commented Sep 29, 2018

@sirsnyder Looks good to me 👍

@sirsnyder
Copy link
Collaborator

sirsnyder commented Oct 26, 2018

@tpunt @krakjoe are the Hashtable changes/fixes ok? I would like to merge this PR within the next days, if there are no concerns.

@sirsnyder sirsnyder mentioned this pull request Oct 27, 2018
@dktapps
Copy link
Contributor Author

dktapps commented Oct 27, 2018

This isn't synced with the latest changes, I haven't had time to update it yet.

@ghost
Copy link

ghost commented Dec 6, 2018

@dktapps @sirsnyder Any updates on this? Release of 7.3 is just around the door.

@dktapps
Copy link
Contributor Author

dktapps commented Dec 6, 2018

@CharlotteDunois I haven't touched this since the 7.3 alphas. I'll take another look at it soon when I find time.

@sirsnyder
Copy link
Collaborator

I'm busy with a huge feature for pthreads in the last few weeks. Would be cool if you can take care of it @dktapps

@@ -595,7 +615,7 @@ static inline void pthreads_prepare_constants(pthreads_object_t* thread) {
case IS_DOUBLE: Z_DVAL(constant.value)=Z_DVAL(zconstant->value); break;
case IS_STRING: {
#if PHP_VERSION_ID >= 70300
Z_STR(constant.value)=Z_STR(zconstant->value);
Z_STR(constant.value)= zend_string_new(Z_STR(zconstant->value));
#else
ZVAL_NEW_STR(&constant.value, zend_string_new(Z_STR(zconstant->value)));
#endif
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block probably does not need the if/else.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, you're right

@@ -1030,15 +1039,30 @@ void pthreads_store_reset(zval *object, HashPosition *position) {

if (pthreads_monitor_lock(threaded->monitor)) {
zend_hash_internal_pointer_reset_ex(threaded->store.props, position);
if (zend_hash_has_more_elements_ex(threaded->store.props, position) == FAILURE) { //empty
*position = HT_INVALID_IDX;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duct tape and should probably be fixed better later.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's not a beauty but it is working for now. And who knows when they will change this in php again.

dktapps and others added 9 commits January 11, 2019 23:01
This bug was caused by changes made in php/php-src@d7f2dc4
There are probably better solutions for this, but this was the simplest and least invasive fix I could come up with.
This issue is described in #1. I think move_forward from a non existing index to an existing one is probably undefined behaviour anyway, so this PR prefers using reset, which is also backwards compatible with 7.2.
use interned strings for globals
fixed one incorrect use of persistent string
work around possible bug in php-src in zend_hash_str_update_ptr() - keys inserted like this inherit persistence from their parent htable, which is not expected for the global function_table
Previously this would yield persistent strings from the props table. Inserting these strings into standard arrays would then cause issues later on.
@dktapps
Copy link
Contributor Author

dktapps commented Jan 12, 2019

I've run some tests and this seems to be ready to r&r. I'm sure more bugs will roll in later on.

@sirsnyder I think this is good to merge.

@sirsnyder
Copy link
Collaborator

@dktapps that's nice to hear. Two days back I've played with debug builds and two tests have mem leaks. The one I've investigated is in pthreads_copy_literals and was probably caused by php/php-src@e70618a#diff-8f41738bb0ceb7bf7c9882a4b399ab6e. I have no write permissions for this branch anymore, so I will push the fix direct to master.

@sirsnyder sirsnyder merged commit f55ffa9 into krakjoe:master Jan 13, 2019
@dktapps dktapps deleted the master73 branch January 15, 2019 21:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants