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

Bug #3304 requestPrefix still broken
Submitted: 2005-01-26 20:43 UTC
From: pm at phpshop dot org Assigned: olivierg
Status: Closed Package: Structures_DataGrid
PHP Version: 4.3.10 OS: Windows
Roadmaps: (Not assigned)    

 [2005-01-26 20:43 UTC] pm at phpshop dot org
Description: ------------ I reported this earlier in the mailing list and it looks liek you tried to fix it in 0.6.1. Here's the code I am using: // Setup DataGrid $dg =& new Structures_DataGrid(SEARCH_ROWS, $_page); $dg->requestPrefix = "_"; $dg->bind($module); This works fine. However, if there is a page variable in the URL (i.e. isset($_REQUEST['page'])) then the datagrid does not show any data. If I do this while page is being used in the URL: // Setup DataGrid unset(_$REQUEST['page']); $dg =& new Structures_DataGrid(SEARCH_ROWS, $_page); $dg->requestPrefix = "_"; $dg->bind($module); Then it works fine. I think it is ignoring the second argument of the Structures_DataGrid constructor.


 [2005-01-26 22:10 UTC] asnagy at webitecture dot org
Thank you for taking the time to write to us, but this is not a bug. In order to set the requestPrefix you must us the ->setRequestPrefix() method. The requestPrefix variable should be listed as private and will be in the next release.
 [2005-01-26 23:06 UTC] pm at phpshop dot org
I tried what you said but it still has trouble. This is what I changed it to: // Setup DataGrid $dg =& new Structures_DataGrid(SEARCH_ROWS, $_page); $dg->setRequestPrefix("_"); $dg->bind($module); I am using a page argument in the URL and the datagrid is empty. If I unset the page variable before the object is instantiated, it works. What I am doing wrong?
 [2005-01-26 23:55 UTC] ylf at xung dot org
Hi, I can't reproduce the bug in here. Can you please : 1 : place an "echo $_page;" before you instantiate the datagrid, so that we can see what this variable contains 2 : try without the second argument, that is a simple : $dg =& new Structures_DataGrid(SEARCH_ROWS); Usually you don't need to specify this second parameter, since Structures_DataGrid will extract it by itself from the GET variables.
 [2005-01-27 00:41 UTC] pm at phpshop dot org
I echoes the $_page variable and it returns "1". This is what I expect it to be. If I do the following: $_REQUEST['page'] = "test"; $dg =& new Structures_DataGrid(SEARCH_ROWS); $dg->setRequestPrefix("_"); $dg->bind($module); It also breaks the grid. Try that on your end to see if you can recreate the problem. Thanks.
 [2005-02-03 19:10 UTC] pm at phpshop dot org
Hi, Were you able to recreate the problem?
 [2005-02-03 19:49 UTC] ojai at nerim dot net
Yes I was. Thank you for reporting what definitely is a bug. Actually, at first, I couldn't reproduce it because I always had both a "page" and a "_page" GET parameters. The behaviour you describe happens when there only is a "page" GET parameter, and that this $_GET['page'] variable evaluates to zero, as a string for example. Indeed, setRequestPrefix('_') doesn't help at all. Here's a patch that fixes this bug. It applies just fine against Structures_Datagrid 0.6.2 : I sent this patch one week ago to Andrew, the lead maintainer, I explained him the bug in detail. Since I'm only a helper I can't access the cvs tree directly. Cheers
 [2005-07-26 19:32 UTC] asnagy
Can you please test this again with the latest code from CVS. The head branch has changed so much that Olivier's patch is too old.
 [2005-10-10 23:49 UTC] olivierg at php dot net
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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.