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 05:16 UTC Modified: 2007-03-11 09:27 UTC
From: derernst Assigned: wiesemann
Status: Closed Package: Structures_DataGrid (version 0.8.1)
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2007-02-28 05: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.

Comments

 [2007-03-07 07: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 03: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 09:27 UTC] wiesemann (Mark Wiesemann)
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. --- 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.