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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: streaky at mkybrokenlogic dot com
New email:
PHP Version: OS:

 

 [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-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC