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

Incorrect copying of internal functions from extensions loaded via dl #122

Open
AndrewKusov opened this issue Jun 7, 2023 · 1 comment

Comments

@AndrewKusov
Copy link

AndrewKusov commented Jun 7, 2023

Environment

  • PHP: 8.2.4
  • pthreads: 6.0.2
  • OS: Windows 8.1 x64
  • OPcache: no

Summary

Extensions imported using dl in the main thread incorrectly copy functions to the one created using the extension, although the extension is connected. The problem is solved only if you manually register module_entry->functions in pthreads_prepared_startup, according to the code from zend_register_module_ex

Reproducing Code

dl('mbstring');
//////////

use pmmp\thread\Thread as Thread;
$thread = new class extends Thread
{
	public function run() : void
	{
		print_r(mb_strtolower('text'));
	}
};
$thread->start(Thread::INHERIT_ALL) && $thread->join();

Expected Output

text

Actual Output

Call to undefined function mb_strtolower

@dktapps
Copy link
Member

dktapps commented Jun 19, 2023

Currently the extension assumes that all functions will be automatically present on other threads. dl() was never considered. To be honest, I'm not actually 100% sure it makes sense for dl() to affect other threads anyway.

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

No branches or pull requests

2 participants