|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60853 Missing NCURSES_KEY_HOME constant
Submitted: 2012-01-23 15:38 UTC Modified: 2012-01-28 02:35 UTC
From: mbt at gator dot net Assigned: rasmus (profile)
Status: Closed Package: ncurses (PECL)
PHP Version: 5.3.9 OS: Linux
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.
Bug Type:
From: mbt at gator dot net
New email:
PHP Version: OS:


 [2012-01-23 15:38 UTC] mbt at gator dot net
The PECL ncurses extension has a regression:  the NCURSES_KEY_HOME constant is 
not defined when the extension is loaded.

How on earth did this happen??  The first clue I had something was amiss with 
the ncurses codebase showed up in a diff between the PHP 5.2.17 tarball with 
the ncurses extension incorporated and the PECL 1.0.0 tarball:  the ncurses 
files had 2010 as the copyright year; the PECL sources had 2006.

The key difference is in ncurses.c, in which the list of constant-initializing 
macros is rearranged.  The PECL version lacks a PHP_NCURSES_CONST(KEY_HOME) 

A look through the history is a bit more disturbing.  The oldest PHP tarball I 
could find--for version 5.1.4--has ZERO code difference from PECL ncurses 
1.0.0.  Maintenance of the ncurses code did proceed since 2006, especially in 
the rearrangement of the constants in ncurses.c that resulted in adding the 
missing NCURSES_KEY_HOME constant.

How many other regressions happened because you went back to an old version of 
the ncurses code?  I noted a regression at line 1475 of ncurses_functions.c 
that you repaired by version 1.0.1.  The other regressions seem more benign:  
the call to DISPLAY_INI_ENTRIES() in the PHP_MINFO_FUNCTION() at line 277 of 
ncurses.c has nothing to display because there are no .ini entries for the 
extension, and line 35 of ncurses_functions.c has a spelling error (ncruses 
instead of ncurses).

I tried looked at the Subversion repository, but after letting the checkout 
run for several hours it was still running.

I've given you a patch for that you can apply.  I added that patch to the 
Gentoo ebuild I made for dev-php5/pecl-ncurses-1.0.0, rebuilt it, and saw that 
it worked.  I'm hoping the fix makes it out to Debian to get into Squeeze (and 
PHP 5.3) by the time we move to Squeeze at work.

Test script:
if (defined('NCURSES_KEY_END'))  {
   if (defined('NCURSES_KEY_HOME'))  {
      echo "PHP has ncurses with definitions for the Home and End keys\n";
   else  {
      echo "Oops:  ncurses extension lacks Home key!!\n";
else  {
   echo "It looks like the ncurses extension is not enabled\n";

Expected result:
PHP has ncurses with definitions for the Home and End keys

Actual result:
Oops:  ncurses extension lacks Home key!!


restore_homekey.diff (last revision 2012-01-23 15:39 UTC by mbt at gator dot net)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-24 14:52 UTC] mbt at gator dot net
-Package: ncurses related +Package: ncurses
 [2012-01-24 14:52 UTC] mbt at gator dot net
Changed package from "Extensibility functions > ncurses related" to "PECL > 
ncurses".  Bah!  I miss the unified code base, a la the Linux kernel.
 [2012-01-28 02:34 UTC]
Automatic comment from SVN on behalf of rasmus
Log: Fix bug #60853
 [2012-01-28 02:35 UTC]
Patch applied, thanks.
 [2012-01-28 02:35 UTC]
-Status: Open +Status: Closed -Assigned To: +Assigned To: rasmus
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Sep 28 05:01:24 2023 UTC