Welcome Guest, Not a member yet? Register   Sign In
[solved] Magic __destruct - Win vs. Mac
#1

[eluser]PhilTem[/eluser]
Hey everyone,

long time nothing but replies and answers from me, but now I'm back with a problem/question myself.

I just changed my development machine from a Win7 to a MacBook Pro with OS X Lion. And I had thought, everything works well on a UNIX-like system after copy-pasting my files from the Win-machine. But obviously it didn't.

Here's what happens:
There's a library with the magic __destruct function which basically does nothing else than just write some data to the session. Code looks like this

Code:
// Check if we got the CI object. If we don't have any, we would trigger errors with
// the upcoming lines.
if ( isset($this->CI) )
{
    // Log a debugging message so we know what is going on here
    log_message('debug', 'ICF_Message: Library shutting down, saving all messages to session');
    
    // And save all data into our session
    $this->CI->session->set_userdata($this->_config['session_key'], serialize($this->_messages));
}

With my Windows machine there are no errors coming up when accessing any page. However, Mac prompts the following

Quote:Warning: include(icf/errors/error_php.php) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/icf/codeigniter/core/Exceptions.php on line 182

Warning: include() [function.include]: Failed opening 'icf/errors/error_php.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/icf/codeigniter/core/Exceptions.php on line 182

Warning: include(icf/errors/error_php.php) [function.include]: failed to open stream: No such file or directory in /Applications/XAMPP/xamppfiles/htdocs/icf/codeigniter/core/Exceptions.php on line 182

Warning: include() [function.include]: Failed opening 'icf/errors/error_php.php' for inclusion (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear') in /Applications/XAMPP/xamppfiles/htdocs/icf/codeigniter/core/Exceptions.php on line 182

I did a debug_backtrace() on line 182 of Exceptions.php and I see a line stating

Quote:[function] => show_php_error
[class] => CI_Exceptions
[args] => Array
(
[0] => 2
[1] => Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/icf/codeigniter/core/Output.php:445)
[2] => /Applications/XAMPP/xamppfiles/htdocs/icf/codeigniter/libraries/Session.php
[3] => 672
)

which actually says: Output sent, cannot change the session anymore.

So now I got two questions:

1) Why didn't I receive these errors on my Windows machine?

2) How can I solve my problem? The idea, why I added the __destruct method, was to wait for all messages to be defined and then just write the session data instead of writing it over and over again whenever a new message is set (the library shall be used for flash-messages).

Maybe somebody, who is not overwhelmed by my long post, can shed some light on this issue - even though I thought I knew how to write PHP and knew all the tricks of PHP.


Thanks!


Messages In This Thread
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-19-2012, 08:53 AM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-19-2012, 12:45 PM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-19-2012, 12:47 PM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-19-2012, 01:24 PM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-19-2012, 03:58 PM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-19-2012, 07:30 PM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-20-2012, 07:37 PM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-22-2012, 06:23 AM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-22-2012, 08:45 AM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-22-2012, 09:50 AM
[solved] Magic __destruct - Win vs. Mac - by El Forum - 06-22-2012, 10:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB