php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64990 Segmentation Fault @ newt_checkbox_tree_add_item
Submitted: 2013-06-07 22:26 UTC Modified: 2013-10-14 12:42 UTC
Votes:5
Avg. Score:4.0 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:1 (20.0%)
Same OS:1 (20.0%)
From: recibe_distraction at hotmail dot com Assigned: michael (profile)
Status: Closed Package: newt (PECL)
PHP Version: 5.4.16 OS: Ubuntu 10.04
Private report: No CVE-ID: None
 [2013-06-07 22:26 UTC] recibe_distraction at hotmail dot com
Description:
------------
I like this newt library, although its not documented and no one appears to use 
it. Would like to use it. But then again, I'd like a lot of things. 

Test script:
---------------
<?php
newt_init ();
newt_cls ();

$rows = 70;
$cols = 25;

newt_open_window ($rows/2-17, $cols/2-10, 34, 17, "Don't be a Tool");

$form = newt_form ();


//CHECK BOX TREE
$checkbox = newt_checkbox_tree(3, 2, 20,NEWT_CHECKBOXTREE_EXPANDED);
$arr = array(
        "Authentication configuration",
        "Firewall configuration",
        "Mouse configuration",
        "Network configuration",
        "Printer configuration",
        "System services");

foreach($arr as $key=>$l_item);
{
    newt_checkbox_tree_add_item($checkbox, $l_item,'',NEWT_CHECKBOXTREE_UNSELECTED,$key);
}
exit;


newt_form_add_component ($form, $checkbox);
newt_refresh ();

$b1 = newt_button (5, 12, "Run Tool");
$b2 = newt_button (21, 12, "Quit");

newt_form_add_components ($form, array($b1, $b2));

newt_refresh ();
newt_run_form ($form);

newt_pop_window ();
newt_pop_help_line ();
newt_finished ();

newt_form_destroy ($form);

Expected result:
----------------
Expect script to render checkbox_tree via continuing with the following code:

Actual result:
--------------
Throws a segmentation fault prior to exit.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-08 18:51 UTC] recibe_distraction at hotmail dot com
-Summary: Segmentation Fault +Summary: Segmentation Fault @ newt_checkbox_tree_add_item
 [2013-06-08 18:51 UTC] recibe_distraction at hotmail dot com
The error takes place when using newt_checkbox_tree_add_item
 [2013-08-23 21:45 UTC] a at b dot com
Same problem. Would be nice if someone fixed this.
 [2013-10-13 15:37 UTC] remi@php.net
Automatic comment from SVN on behalf of remi
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=331797
Log: Fix bug #64990 Segmentation Fault @ newt_checkbox_tree_add_item
 [2013-10-13 15:39 UTC] remi@php.net
The last option of   newt_checkbox_tree_add_item MUST be NEWT_ARG_LAST.

Despite, this should not raise a segfault.

Can you try from SVN ? Commit 331797 should avoid this.
 [2013-10-14 12:42 UTC] michael@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: michael
 [2013-10-14 12:42 UTC] michael@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Remi, I've verified your fix. Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 06:01:30 2024 UTC