php.net |  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
43 - 36 = ?
Subscribe to this entry?

 
 [2012-07-08 17:00 UTC] streaky at mkybrokenlogic dot com
Description:
------------
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:
---------------
<?php

var_dump(chroot("/chroot/me/here/"));


Expected result:
----------------
bool(true)

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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-07-08 21:02 UTC] johannes@php.net
-Status: Open +Status: Not a bug
 [2012-07-08 21:02 UTC] johannes@php.net
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] laruence@php.net
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-2020 The PHP Group
All rights reserved.
Last updated: Thu Oct 22 10:01:24 2020 UTC