Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.3.1

Bug #2676 Setting selected value doesn't work
Submitted: 2004-11-03 09:33 UTC
From: jakob dot grimstveit at starshipping dot com Assigned: cweiske
Status: Closed Package: HTML_Select
PHP Version: 4.3.9 OS: RedHat 9
Roadmaps: (Not assigned)    
Subscription  


 [2004-11-03 09:33 UTC] jakob dot grimstveit at starshipping dot com
Description: ------------ The "selected"-functionality of HTML_Select looks b0rken to me. $ pear list-all|grep Select HTML_Select_Common 1.1 HTML_Select 1.2.1 Configure Command => './configure' '--with-apxs=/usr/local/apache/bin/apxs' '--with-oci8=/oracle8' '--with-config-file-path=/www/conf' '--enable-sigchild' '--without-mysql' '--with-ldap' '--with-unixODBC' '--with-curl' '--with-gd' '--with-zlib' '--with-freetype' '--with-ttf' PHP.ini should be irrelevant. Reproduce code: --------------- $tradecodebox->loadDbResult(db_get("select distinct patterncode from stardl_voyage_header where patterncode is not null order by patterncode asc", db_getdsn(0), true), 'PATTERNCODE', 'PATTERNCODE', $tradecode); Expected result: ---------------- Input patterncode is 'USWC', this should thus have been selected in the dropdown. Actual result: -------------- <select name="owdlcomp_searchtradecode" size="1"><option value="AC">AC</option><option value="ALITIS">ALITIS</option><option value="ANTAMINA">ANTAMINA</option><option value="ATL">ATL</option><option value="ATL/PAC">ATL/PAC</option><option value="ATLANTIC">ATLANTIC</option><option value="AUS.SUGA">AUS.SUGA</option><option value="AUS/FE-I">AUS/FE-I</option><option value="B-BRAZIL">B-BRAZIL</option><option value="B-MED">B-MED</option><option value="B-PAC">B-PAC</option><option value="B-SEA">B-SEA</option><option value="BALLANCE">BALLANCE</option><option value="BC">BC</option><option value="BRAZIL">BRAZIL</option><option value="BRAZIT">BRAZIT</option><option value="EC">EC</option><option value="EUASIA">EUASIA</option><option value="FEAST">FEAST</option><option value="FEWC">FEWC</option><option value="FEWCX">FEWCX</option><option value="FREEPORT">FREEPORT</option><option value="GULF">GULF</option><option value="MARKET">MARKET</option><option value="MED">MED</option><option value="MYSTRAS">MYSTRAS</option><option value="PAC">PAC</option><option value="PAC/ATL">PAC/ATL</option><option value="PAC/IND">PAC/IND</option><option value="PAC/PERU">PAC/PERU</option><option value="QVC">QVC</option><option value="RELET">RELET</option><option value="RTS">RTS</option><option value="SAF/BRAZ">SAF/BRAZ</option><option value="SEA">SEA</option><option value="SEAX">SEAX</option><option value="TGC">TGC</option><option value="USG">USG</option><option value="USWC">USWC</option><option value="USWCX">USWCX</option><option value="VSP">VSP</option><option value="WC-AUST">WC-AUST</option></select> As seen above, USWC is not selected.

Comments

 [2006-10-06 19:32 UTC] scottmattocks (Scott Mattocks)
Index: Select.php =================================================================== RCS file: /repository/pear/HTML_Select/Select.php,v retrieving revision 1.2 diff -u -r1.2 Select.php --- Select.php 26 Feb 2004 14:20:11 -0000 1.2 +++ Select.php 6 Oct 2006 19:29:26 -0000 @@ -103,6 +103,12 @@ if (is_string($values)) { $values = split("[ ]?,[ ]?", $values); } + // Fix for bug #2676. Basically, if you didn't pass in an array, the + // check in toHtml to see if the value was selected would fail, but the + // @ operator suppressed any warnings. + if (!is_array($values)) { + $values = array($values); + } $this->_values = $values; }
 [2006-12-14 12:34 UTC] cweiske (Christian Weiske)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.