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

Bug #4371 Introduction documentation error
Submitted: 2005-05-17 20:41 UTC
From: jloiselle Assigned: aashley
Status: Closed Package: Auth
PHP Version: 5.0.4 OS: FreeBSD
Roadmaps: (Not assigned)    
Subscription  


 [2005-05-17 20:41 UTC] jloiselle
Description: ------------ Introduction documentation incorrectly shows $dsn being passed into the Auth constructor's second parameter as a string instead of an array. Reproduce code: --------------- This causes PHP5 to produce the error: Fatal error: Cannot unset string offsets in /usr/local/lib/php/pear/Auth.php on line 180 Documentation should be resolved.

Comments

 [2005-05-24 16:01 UTC] danielc
Changing package from "Documentation" to "Auth".
 [2005-06-17 11:33 UTC] oliver at realtsp dot com
php 5.0.3 FreeBSD 5.3 stable exactly the same error, but for a "File" auth backend. this is my call the Auth constructor: $a = new Auth("File", ".htpasswd"); this is the error: Fatal error: Cannot unset string offsets in /usr/local/lib/php/pear/Auth.php on line 180 this is a patch/fix which I have made to Auth.php (v1.2.3) function Auth($storageDriver, $options = '', $loginFunction = '', $showLogin = true) { if (is_array($options) && !empty($options['sessionName'])) { $this->_sessionName = $options['sessionName']; unset($options['sessionName']); } note that is checking whether $options is an array before attempting to index into it (indexing into a string with an associative key, can't work). Noticed that the betaRC2 release does not seem to have this code at all. But I am not about to run beta Auth on a production server.
 [2005-07-11 19:54 UTC] plamendp at gmail dot com
This is really terrible. Absolutely discouraging!! I've read so much about PEAR (I am using PHPLIB etc since 2000). Finally I installed and tryied Auth package. Got this error. Wow! What a "stable" !!!?? FreeBSD 4-STABLE PHP 5.x.x
 [2005-07-13 16:18 UTC] tjerk dot meesters at gmail dot com
I do believe this is because of PHP5. PHP4 always handles square brackets as array, without fallback. PHP5 tries to treat it as array, but falls back to trying to convert the index into an integer to use for a string offset. Nevertheless, the documentation says this parameter can be mixed; therefore a proper type check should be performed. A simple is_array() would suffice, as oliver suggested.
 [2005-10-27 19:23 UTC] innergatedesigns at gmail dot com
I concur, is_array suggested by oliver is the correct solution.
 [2005-11-17 21:54 UTC] joakim at jokke dot dk
Has development stopped? It seems to be a long time since the last version was released and this patch has not been commited...
 [2006-02-18 08:48 UTC] nishikata at gmail dot com
The error shown above is because of php version.But the scritp that we can see in the top of introduction documentation did't work correctly at all while i switch php version to php4 in my enviroment.It may include another bug,Someone should modify it or add notice. mac os X panther mysql 4.1
 [2006-02-21 05:32 UTC] aashley at php dot net
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.
 [2006-05-30 15:40 UTC] benjamin at coldrose dot com (Benjamin Sims)
I don't believe that this bug is resolved in the current version of the package - I have just downloaded Auth 1.3.0, and I get the same thing in PHP5. PHP4 appears to work normally, as discussed in other comments. aashley at php dot net says that this is fixed, but that fix has not appeared yet in the stable version.
 [2006-05-30 17:57 UTC] benjamin at coldrose dot com (Benjamin Sims)
sorry, ignore that, it works perfectly... my own config problems. Thanks to Ashley!