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

Curl valgrind issue #318

Merged
merged 5 commits into from
Dec 14, 2021
Merged

Curl valgrind issue #318

merged 5 commits into from
Dec 14, 2021

Conversation

ZNeumann
Copy link
Contributor

@ZNeumann ZNeumann commented Dec 8, 2021

This PR addresses an issue that was left unnoticed from the transition to PHP 8.0. There was still an instance of using the curl handle as a resource instead of an object. This issue was found when exploring the upgrade to PHP 8.1.

@ZNeumann ZNeumann linked an issue Dec 8, 2021 that may be closed by this pull request
3 tasks
}

#define ensure_curl_multi_metadata_hashmap() \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't find a reason why several of these macros were used instead of functions. For easier readability- as well as less code duplication when adding the ifdefs to fix the issue- I changed them to functions. I also moved some functions around so that definitions were in the correct order.

@ZNeumann ZNeumann requested review from mfulb and zsistla December 8, 2021 22:51
agent/php_zval.h Outdated
if (!nr_php_is_zval_valid_resource(zv))
{
return 0;
}
#ifdef PHP7
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please update the style for readability:
#if ZEND_MODULE_API_NO >= ZEND_7_0_X_API_NO /* PHP 7.0+ */

Currently PHP7 actually indicates PHP7+.

Comment on lines 128 to 129
nr_php_curl_multi_md_t* multi_metadata;
size_t async_index;
Copy link
Contributor

Choose a reason for hiding this comment

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

Now that the id check is happening here, can we move the variable definitions up to the top of the function?

#else
uint64_t id = (uint64_t)nr_php_zval_resource_id(ch);
#endif
if (id == 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

Flip around for yoda conditions (styleguide).

Same comment for here.

@zsistla
Copy link
Contributor

zsistla commented Dec 13, 2021

Aside from a few nits, it looks great! Thanks for finding/fixing this. It'll be great to get this fix merged.

@zsistla
Copy link
Contributor

zsistla commented Dec 13, 2021

Looks like jenkins is showing some errors for the PHP 5.5 build which is probably why they were initially macros, but it's still fixable for the functions. I think you can just take the TSRM value you get here and pass it into your new functions that have TSRM in the signatures.

@ZNeumann ZNeumann requested a review from zsistla December 13, 2021 21:04
@ZNeumann ZNeumann merged commit 7494f17 into newrelic:dev Dec 14, 2021
@ZNeumann ZNeumann deleted the curl-valgrind-issue branch February 28, 2023 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[PHP] Investigate and fix valgrind failures with PHP 8.1 prototype
3 participants