|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62509 chroot() is disabled with ZTS enabled
Submitted: 2012-07-08 17:00 UTC Modified: 2012-07-09 05:29 UTC
From: streaky at mkybrokenlogic dot com Assigned:
Status: Not a bug Package: Directory function related
PHP Version: Irrelevant OS: Anything but windows?
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: streaky at mkybrokenlogic dot com
New email:
PHP Version: OS:


 [2012-07-08 17:00 UTC] streaky at mkybrokenlogic dot com
chroot() seems to be arbitrarily disabled with ZTS enabled. It seems like it is disabled because when ZTS is -usually- used it is with a sapi that requires thread safety but this isn't always the case.

AFAIK there isn't a good reason for it, I assume it's some sort of oversight - a cheap and cheerful way to achieve the above, but it doesn't account for all circumstances so you have to go hacking on the source code in about 3 different places.

It probably should be as is *except* for if CLI and possibly CGI is the SAPI.

Test script:


Expected result:

Actual result:
Fatal error: Call to undefined function chroot()


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-08 21:02 UTC]
-Status: Open +Status: Not a bug
 [2012-07-08 21:02 UTC]
You shouldn't use ZTS binaries in non-threaded context. They need more memory, they are slower, they are harder to debug in case of critical errors.

That aside: We have no good mechanism to disable it easily in one context only.
 [2012-07-09 05:29 UTC]
maybe we can always return false in ZTS build, and trigger a warning.
 [2012-07-09 15:10 UTC] streaky at mybrokenlogic dot com
There are situations where you need to regardless - for example runkit needs ZTS - if you need runkit and chroot() currently you can't do it without the aforementioned hack. Besides this *is* a threaded context.

There's no good thread safety reason why chroot() would be disabled besides the "it's hard to get it to configure like that" is there? I'm okay with the way it is just in principle it seems wrong to me - personally I can do it in a patch...
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Jan 24 18:01:22 2021 UTC