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

Bug #10213 Non-static call in static dataSourceFactory method
Submitted: 2007-02-28 10:16 UTC
From: derernst Assigned: wiesemann
Status: Closed Package: Structures_DataGrid (version 0.8.1)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Comments Add Comment Add patch

Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem : 17 + 21 = ?

 [2007-02-28 10:16 UTC] derernst (Markus Ernst)
Description: ------------ In DataGrid.php at line 412 the non-static method _correctDriverName() is called from the static method dataSourceFactory(): $type = $this->_correctDriverName($type, 'DataSource'); I tried to change this to a static call, but then the problem is moved to _correctDriverName() which refers to the _driverNameMap instance variable, which does not work in static context, as there are no static class variables in PHP4.


 [2007-03-07 12:32 UTC] wiesemann (Mark Wiesemann)
Markus, can you please provide a short example script? I couldn't produce any errors with PHP 4.4.6 and PHP 5.2.1 related to correctDriverName(). Thanks!
 [2007-03-08 08:42 UTC] derernst
require_once 'Structures/DataGrid.php'; $source = 'Hello,world'; $driver =& Structures_DataGrid::dataSourceFactory($source, array(), DATAGRID_SOURCE_CSV); Results in: Fatal error: Using $this when not in object context in [...]/Structures/DataGrid.php on line 412 PHP 5.0.5, Apache 2.0, Safe-mode on
 [2007-03-11 13:27 UTC] wiesemann (Mark Wiesemann)
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. --- There was no real need to have the driver name map as a class property. Now it's just an array inside the method, and static calls can be used.