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

Check if the function is declared before declaring it. #36

Merged
merged 1 commit into from Mar 27, 2019

Conversation

Projects
None yet
5 participants
@Niko9911
Copy link
Contributor

commented Mar 20, 2019

In case you use pthreads or something else related to threading you might encounter this issue. It happens only with functions and is fixable only by adding these checks. Another way to avoid this is to wrap functions as static into classes.

@trowski

This comment has been minimized.

Copy link

commented Mar 20, 2019

Sounds like you're inheriting class and function definitions with pthreads, then including the Composer autoloader again. If this is the case, that's the real problem to be fixed.

If there is some other scenario that can lead to this problem, please describe it.

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 20, 2019

Well, yes I need to include autoloader again. Without it I get undefined error. 🙃
Will be checking few probably causes tomorrow.

@trowski

This comment has been minimized.

Copy link

commented Mar 20, 2019

I recommend using PTHREADS_INHERIT_INI only and then including the Composer autoloader in the thread.

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 20, 2019

I'm using none currently, but lez see...

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

@trowski Confirmed same issue.

image
image

image
image

image

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

@WyriHaximus
Copy link
Member

left a comment

This makes total sense to me but I rather see that we use a functions_include.php like we do in other packages, for example: https://github.com/reactphp/promise-stream/blob/master/src/functions_include.php

@WyriHaximus WyriHaximus requested review from clue and jsor Mar 21, 2019

@WyriHaximus WyriHaximus added this to the v1.5.1 milestone Mar 21, 2019

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

@WyriHaximus Thank you!

I will make requested changes after I finish some critical work.

@trowski

This comment has been minimized.

Copy link

commented Mar 21, 2019

@Niko9911 There's something else going wrong. We use pthreads in amphp/parallel and have no issues with functions being redeclared, and we have no conditionals around function declarations.

Here is our definition of Thread::run() and where we call Thread::start().

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

Maybe because itäs used by pool?
image

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

@WyriHaximus Requested changes are made.

@WyriHaximus
Copy link
Member

left a comment

LGTM 👍

One more thing, could you squash them into one commit?

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

Sure!

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 21, 2019

Done, ty.

@jsor

jsor approved these changes Mar 21, 2019

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 26, 2019

Status? @clue

@clue

clue approved these changes Mar 27, 2019

@clue clue merged commit d19fe5d into reactphp:master Mar 27, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@WyriHaximus

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

Cheers, will tag this shortly 👍

@Niko9911

This comment has been minimized.

Copy link
Contributor Author

commented Mar 27, 2019

THANK YOU EVERYBODY!

@Niko9911 Niko9911 deleted the Niko9911:patch-1 branch Mar 27, 2019

@WyriHaximus

This comment has been minimized.

Copy link
Member

commented Mar 27, 2019

Ok v1.5.1 has been released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.