Page MenuHomePhabricator

posix_isatty() check insufficient?
Closed, ResolvedPublic

Description

As reported on IRC:
$ php /var/www/mediawiki/maintenance/update.php
PHP Fatal error: Cannot redeclare posix_isatty() in /var/www/mediawiki/maintenance/Maintenance.php on line 27

Weird, since posix_isatty() should be wrapped in a function_exists() check.


Version: unspecified
Severity: normal

Details

Reference
bz30172

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:48 PM
bzimport set Reference to bz30172.

IIRC it's actually possible to disable functions from php.ini, in which case they don't turn up on function_exists() but you can't redeclare them. (Reflection may do better at finding them to confirm existence.)

Of course this'd be a pretty weird thing to disable...

Created attachment 8874
posix_isatty() patch

Rather than doing a conditional function define (which HipHop won't like anyway), I just threw it in a wrapper method in Maintenance. Nothing in extensions calls this--and few core maintenance scripts even do--so the impact should be minimal.

Just asking for a quick sanity check that this will work as intended.

Attached:

EN.WP.ST47 wrote:

That patch looks plenty sane, Chad, should work as intended. I feel bad about the !$fd hack, but that's just the part of me that wants to be a good person and have readable code ;)
+reviewed

EN.WP.ST47 wrote:

I think you mean r93789. If not, I'm wondering where you found the time machine?

tdebaets98 wrote:

Would it be possible to backport this to 1.18? I'm currently unable to upgrade my wiki because of this bug. Thanks.