[pLog-svn] r6484 - plog/trunk/class/database

Jon Daley plogworld at jon.limedaley.com
Wed May 28 10:03:01 EDT 2008


Heh, a user just asked for this, or at least something similar, could be 
handled either by handling the exception or by using ob_*.

I am not all that thrilled with exceptions, but if we want to use 
exceptions everywhere, I would be okay with that route.  Right now we only 
use exceptions in some places.

http://bugs.lifetype.net/view.php?id=1517

On Mon, 26 May 2008, Jon Daley wrote:

> 	I meant the line number.  But, I was able to duplicate it anyway.
> Presumably my php has been upgraded since I last checked it.
>
> It looks like a bug in php to me.
>
> If I replace:
> ob_end_flush();
>
> with:
> $var = ob_get_clean();
> print $var;
> ob_end_flush();
>
> It works fine.  That doesn't seem like correct behavior to me.
>
>
> On Tue, 27 May 2008, Mark Wu wrote:
>> Cannot modify header information - headers already send
>> 
>>> -----Original Message-----
>>> From: plog-svn-bounces at devel.lifetype.net
>>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
>>> Sent: Tuesday, May 27, 2008 12:50 AM
>>> To: LifeType Developer List
>>> Subject: Re: [pLog-svn] r6484 - plog/trunk/class/database
>>>
>>>  	What is the error message?  I ran this code and it worked fine.
>>> 
>>> On Tue, 27 May 2008, Mark Wu wrote:
>>> 
>>>> Not only windows, even Ubuntu has the same error messages.
>>>> 
>>>> Mark
>>>> 
>>>>> -----Original Message-----
>>>>> From: plog-svn-bounces at devel.lifetype.net
>>>>> [mailto:plog-svn-bounces at devel.lifetype.net] On Behalf Of Jon Daley
>>>>> Sent: Monday, May 26, 2008 10:32 PM
>>>>> To: LifeType Developer List
>>>>> Subject: Re: [pLog-svn] r6484 - plog/trunk/class/database
>>>>>
>>>>>  	Is this on windows?  Maybe the ob_flush is broken on
>>> windows.  You
>>>>> shouldn't see any errors unless the database can't be opened.
>>>>>  	What is the exact error message - ie. what line is causing the
>>>>> output?
>>>>> 
>>>>> On Sun, 25 May 2008, mark at devel.lifetype.net wrote:
>>>>> 
>>>>>> Author: mark
>>>>>> Date: 2008-05-25 23:18:26 -0400 (Sun, 25 May 2008) New
>>>>> Revision: 6484
>>>>>> 
>>>>>> Modified:
>>>>>>   plog/trunk/class/database/ltdb.class.php
>>>>>> Log:
>>>>>> Revert the change of rev. 6451 from jon. That commit cause
>>>>> "header already sent" message in every where.
>>>>>> 
>>>>>> Modified: plog/trunk/class/database/ltdb.class.php
>>>>>> 
>>> ===================================================================
>>>>>> --- plog/trunk/class/database/ltdb.class.php
>>>>> 2008-05-24 19:42:18 UTC (rev 6483)
>>>>>> +++ plog/trunk/class/database/ltdb.class.php
>>>>> 2008-05-26 03:18:26 UTC (rev 6484)
>>>>>> @@ -76,26 +76,20 @@
>>>>>>                 $dbcharset = $fileConfig->getValue(
>>>>> "db_character_set", DEFAULT_DATABASE_CHARSET );
>>>>>>                 $dbpersistent   = $fileConfig->getValue(
>>>>> "db_persistent" );
>>>>>>                 if($dbpersistent == true) {
>>>>>> -                    ob_start();
>>>>>> 	            	if( !$db->PConnect( $host, $username,
>>>>> $password, $dbname, $dbcharset )) {
>>>>>> -                            // some hosts don't allow
>>>>> persistent connections, just retry
>>>>>> -                            // with a regular connect, and
>>>>> avoid an error message
>>>>>> -                        if( !$db->Connect( $host,
>>>>> $username, $password, $dbname, $dbcharset )) {
>>>>>> -                            $message = "Fatal error: could
>>>>> not connect to the database!".
>>>>>> -                                " Error:
>>>>> ".$db->ErrorMsg().ob_get_clean();
>>>>>> -                            throw( new Exception( $message ));
>>>>>> -                        }
>>>>>> -                    }
>>>>>> -                    ob_end_flush();
>>>>>> +	            	    $message = "Fatal error: could not
>>>>> connect to the database!".
>>>>>> +	            	               " Error: ".$db->ErrorMsg();
>>>>>> +	            		throw( new Exception( $message ));
>>>>>> +	            		die();
>>>>>> +	            	}
>>>>>>             	}
>>>>>>             	else {
>>>>>> -                    ob_start();
>>>>>> 	            	if( !$db->Connect( $host, $username,
>>>>> $password, $dbname, $dbcharset )) {
>>>>>> 	            	    $message = "Fatal error: could not
>>>>> connect to the database!".
>>>>>> -	            	               " Error:
>>>>> ".$db->ErrorMsg().ob_get_clean();
>>>>>> +	            	               " Error: ".$db->ErrorMsg();
>>>>>> 	            		throw( new Exception( $message ));
>>>>>> +	            		die();
>>>>>> 	            	}
>>>>>> -                    ob_end_flush();
>>>>>>             	}
>>>>>>
>>>>>> 				// pass the options to the
>>>>> driver, if any
>>>>>> 
>>>>>> _______________________________________________
>>>>>> pLog-svn mailing list
>>>>>> pLog-svn at devel.lifetype.net
>>>>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>>>> 
>>>>> 
>>>>> --
>>>>> Jon Daley
>>>>> http://jon.limedaley.com/
>>>>> 
>>>>> This problem will take an infinite amount of time.  This
>>> doesn't seem
>>>>> very feasible, since we don't have an infinite amount of time.
>>>>> In fact, we have less than a month.
>>>>> -- Professor Tygar
>>>>> _______________________________________________
>>>>> pLog-svn mailing list
>>>>> pLog-svn at devel.lifetype.net
>>>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>> 
>>>> _______________________________________________
>>>> pLog-svn mailing list
>>>> pLog-svn at devel.lifetype.net
>>>> http://limedaley.com/mailman/listinfo/plog-svn
>>>> 
>>> 
>>> --
>>> Jon Daley
>>> http://jon.limedaley.com/
>>> 
>>> I pass chain letters along to all my friends. AND I VOTE!
>>> -- Cort Stratton
>>> _______________________________________________
>>> pLog-svn mailing list
>>> pLog-svn at devel.lifetype.net
>>> http://limedaley.com/mailman/listinfo/plog-svn
>> 
>> _______________________________________________
>> pLog-svn mailing list
>> pLog-svn at devel.lifetype.net
>> http://limedaley.com/mailman/listinfo/plog-svn
>> 
>
>

-- 
Jon Daley
http://jon.limedaley.com/

Hard work pays off in the future. Laziness pays off now.


More information about the pLog-svn mailing list