Re: Why does `setcookie` send header before throwing `Error` exception?

[email protected] (Jair López)
Newsgroups php.general
Message-ID <PH0PR15MB43669920B96D77214C457393E8779@PH0PR15MB4366.namprd15.prod.outlook.com>
 > it looks
 > like calling new foo() from within the class def would
 > make it recursively trying to set the cookie.
Actually, the class def begins in one line and ends in the next line 
(the line `new Foo()` is outside of the class def), did I misunderstand 
something?; it is similar to this:

	class Foo {}

which is small enough for illustrating what I think is a discrepancy 
between the two calls I mentioned in previous messages:

 >	setcookie('name', 'value', 1, new Foo());

and

 >	setcookie('name', 'value', array(
 >		'expires' => 1,
 >		'path' => new Foo()
 >	));

The former does not send any header but the latter does.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.