Doc #62788 [NEW]: newt example error. (easy 1-line fix)

From: Date: Thu, 09 Aug 2012 20:04:20 +0000
Subject: Doc #62788 [NEW]: newt example error. (easy 1-line fix)
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8719@lists.php.net to get a copy of this message
From: kevdevsandom at yahoo dot co dot uk Operating system: NA PHP version: Irrelevant Package: newt Bug Type: Documentation Problem Bug description:newt example error. (easy 1-line fix) Description: ------------ --- From manual page: http://www.php.net/newt.examples-usage --- Line 13 needs to be: newt_get_screen_size (&$rows, &$cols); Instead of: newt_get_screen_size ($rows, $cols); More info: This is because those variables aren't created until that point, so without the anpersands it's trying to reference rather than create them and you get this: PHP Notice: Undefined variable: rows in /home/ksandom/files/develop/mass-notready/experimentation/newt/newtExample.php on line 13 PHP Notice: Undefined variable: cols in /home/ksandom/files/devel┌──────┐notready/experimentation/newt/newtExample.php on line 13 The complete code that works for me is included in the test script section. Test script: --------------- <?php newt_init (); newt_cls (); newt_draw_root_text (0, 0, "Test Mode Setup Utility 1.12"); newt_push_help_line (null); newt_draw_root_text (-30, 0, "(c) 1999-2002 RedHat, Inc"); newt_get_screen_size (&$rows, &$cols); newt_open_window ($rows/2-17, $cols/2-10, 34, 17, "Choose a Tool"); $form = newt_form (); $list = newt_listbox (3, 2, 10); foreach (array ( "Authentication configuration", "Firewall configuration", "Mouse configuration", "Network configuration", "Printer configuration", "System services") as $l_item) { newt_listbox_add_entry ($list, $l_item, $l_item); } $b1 = newt_button (5, 12, "Run Tool"); $b2 = newt_button (21, 12, "Quit"); newt_form_add_component ($form, $list); 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: ---------------- Nice text interface. Actual result: -------------- These errors spawled over the interface, and only the quit button shows: PHP Notice: Undefined variable: rows in /home/ksandom/files/develop/mass-notready/experimentation/newt/newtExample.php on line 13 PHP Notice: Undefined variable: cols in /home/ksandom/files/devel┌──────┐notready/experimentation/newt/newtExample.php on line 13 -- Edit bug report at https://bugs.php.net/bug.php?id=62788&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62788&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62788&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62788&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62788&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62788&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62788&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62788&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62788&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62788&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62788&r=support Expected behavior: https://bugs.php.net/fix.php?id=62788&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62788&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62788&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62788&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62788&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62788&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62788&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62788&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62788&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62788&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62788&r=mysqlcfg

« previous php.doc.bugs (#8719) next »