|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-08-31 04:15 UTC] sg at efficientip dot com
Description:
------------
newt_entry_set_filter work only with ascii characters
Reproduce code:
---------------
create a newt entry and assign a filter:
<php?
// newt init + create entry
// ....
newt_entry_set_filter($entry_obj,'filter_ip',NULL);
function filter_ip($obj,$param,$char,$cursor)
{
return($char);
}
?>
This bug come from the cast from integer to a single character in newt_entry_filter_callback_wrapper function.
The following patch correct the issue:
*** newt.c Mon Aug 31 09:43:25 2009
--- newt.c.patch Mon Aug 31 09:43:09 2009
***************
*** 619,625 ****
/* Third parameter is single character */
MAKE_STD_ZVAL (args[2]);
! ZVAL_STRING (args[2], (char *)&ch, 1);
/* Fourth parameter is integer */
MAKE_STD_ZVAL (args[3]);
--- 619,625 ----
/* Third parameter is single character */
MAKE_STD_ZVAL (args[2]);
! ZVAL_LONG (args[2],ch);
/* Fourth parameter is integer */
MAKE_STD_ZVAL (args[3]);
Expected result:
----------------
backspace should work (right/left arrows too)
Actual result:
--------------
backspace and arrows don't work
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 09 08:00:01 2025 UTC |
Here is a sample code: <?php newt_init(); newt_cls(); newt_centered_window(40,10,"Testing"); $form = newt_form(); $text = newt_entry(4,4,15,'',NEWT_ENTRY_RETURNEXIT); newt_form_add_component($form,$text); newt_entry_set_filter($text,'filter_text',NULL); do { newt_refresh(); $exit_param = array(); newt_form_run($form,$exit_param); switch($exit_param['reason']) { case NEWT_EXIT_HOTKEY: $do_loop = FALSE; break; } } while($do_loop == TRUE); newt_pop_window(); newt_finished(); exit(); function filter_text($obj,$param,$char,$cursor) { // accept all characters return($char); } Try to enter a backspace or move the cursor using arrows.