php-general Digest 4 Feb 2009 07:58:51 -0000 Issue 5939
Topics (messages 287566 through 287594):
Throwing an exception seems to defeat output buffering
287566 by: Wickland, Leif
287568 by: Stuart
287573 by: Shawn McKenzie
287579 by: Alpár Török
Re: calculate the time that day ends
287567 by: Stuart
287569 by: Dan Shirah
287570 by: Thodoris
287571 by: Shawn McKenzie
287572 by: Jônatas Zechim
287574 by: Shawn McKenzie
287575 by: Thodoris
287576 by: Shawn McKenzie
287577 by: Shawn McKenzie
287578 by: Thodoris
287580 by: Ralf Meyer
287583 by: tedd
287594 by: Lupus Michaelis
Re: How can I do the opposite of property_exists(), maybe a creat_property() in
PHP5?
287581 by: Daevid Vincent
287582 by: Daevid Vincent
287584 by: Chris
Re: [PROJECT HELP] - JotBug - A Project Management & Issue Tracker written 100%
with Zend Framework
287585 by: rcastley
Is it possible to send POST vars through a header redirect?
287586 by: TS
287587 by: Jim Lucas
287588 by: Kyle Terry
287589 by: VamVan
Re: How can I do the opposite of property_exists(), maybe a create_property()
in PHP5?
287590 by: Daevid Vincent
287591 by: Nathan Nobbe
Re: Visibility of class constant
287592 by: leledumbo
287593 by: Shawn McKenzie
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
I would expect that if I turn on output buffering, echo something, throw an
exception, and catch the exception, nothing will have been actually output..
That doesn't seem to be the case. Throwing an exception seems to defeat output
buffering.
In the following code, I would not expect to see the <h1>, but I do.
<?
try {
ob_start();
echo '<h1>You should not see this!</h1>';
throw new Exception('<h2>This should be the first output.</h2>');
exit( 'Contents: ' . ob_get_clean());
}
catch (Exception $ex) {
exit('<h2>Exception:</h2>' . $ex->getMessage());
}
I'm exercising that code on PHP 5.2.4 and 5.2.8.
Does anybody know why throwing an exception seems to override ob_start(),
flushing the buffered output?
Thank you,
Leif Wickland
--- End Message ---
--- Begin Message ---
2009/2/3 Wickland, Leif <lwickl...@rightnow.com>:
> I would expect that if I turn on output buffering, echo something, throw an
> exception, and catch the exception, nothing will have been actually output..
> That doesn't seem to be the case. Throwing an exception seems to defeat
> output buffering.
>
> In the following code, I would not expect to see the <h1>, but I do.
>
>
>
> <?
> try {
> ob_start();
> echo '<h1>You should not see this!</h1>';
> throw new Exception('<h2>This should be the first output.</h2>');
> exit( 'Contents: ' . ob_get_clean());
> }
> catch (Exception $ex) {
> exit('<h2>Exception:</h2>' . $ex->getMessage());
> }
>
>
> I'm exercising that code on PHP 5.2.4 and 5.2.8.
>
> Does anybody know why throwing an exception seems to override ob_start(),
> flushing the buffered output?
It doesn't, but the end of the script performs an implicit flush.
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
Wickland, Leif wrote:
> I would expect that if I turn on output buffering, echo something, throw an
> exception, and catch the exception, nothing will have been actually output..
> That doesn't seem to be the case. Throwing an exception seems to defeat
> output buffering.
>
> In the following code, I would not expect to see the <h1>, but I do.
>
>
>
> <?
> try {
> ob_start();
> echo '<h1>You should not see this!</h1>';
> throw new Exception('<h2>This should be the first output.</h2>');
> exit( 'Contents: ' . ob_get_clean());
> }
> catch (Exception $ex) {
> exit('<h2>Exception:</h2>' . $ex->getMessage());
> }
>
>
>
>
> I'm exercising that code on PHP 5.2.4 and 5.2.8.
>
> Does anybody know why throwing an exception seems to override ob_start(),
> flushing the buffered output?
>
> Thank you,
>
> Leif Wickland
Others have told you why, so these will work as you want (depending upon
what you want :) You can use ob_end_clean() unless you need the
contents of the buffer. I assigned the return of ob_get_contents() to a
var because I assume you have the exits() for testing.
<?
try {
ob_start();
echo '<h1>You should not see this!</h1>';
$buffer = ob_get_clean();
throw new Exception('<h2>This should be the first output.</h2>');
}
catch (Exception $ex) {
exit('<h2>Exception:</h2>' . $ex->getMessage());
}
-- or --
<?
try {
ob_start();
echo '<h1>You should not see this!</h1>';
throw new Exception('<h2>This should be the first output.</h2>');
}
catch (Exception $ex) {
$buffer = ob_get_clean();
exit('<h2>Exception:</h2>' . $ex->getMessage());
}
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
2009/2/3 Shawn McKenzie <nos...@mckenzies.net>
> Wickland, Leif wrote:
> > I would expect that if I turn on output buffering, echo something, throw
> an exception, and catch the exception, nothing will have been actually
> output.. That doesn't seem to be the case. Throwing an exception seems to
> defeat output buffering.
> >
> > In the following code, I would not expect to see the <h1>, but I do.
> >
> >
> >
> > <?
> > try {
> > ob_start();
> > echo '<h1>You should not see this!</h1>';
> > throw new Exception('<h2>This should be the first output.</h2>');
> > exit( 'Contents: ' . ob_get_clean());
> > }
> > catch (Exception $ex) {
> > exit('<h2>Exception:</h2>' . $ex->getMessage());
> > }
> >
> >
> >
> >
> > I'm exercising that code on PHP 5.2.4 and 5.2.8.
> >
> > Does anybody know why throwing an exception seems to override ob_start(),
> flushing the buffered output?
> >
> > Thank you,
> >
> > Leif Wickland
>
> Others have told you why, so these will work as you want (depending upon
> what you want :) You can use ob_end_clean() unless you need the
> contents of the buffer. I assigned the return of ob_get_contents() to a
> var because I assume you have the exits() for testing.
>
> <?
> try {
> ob_start();
> echo '<h1>You should not see this!</h1>';
> $buffer = ob_get_clean();
> throw new Exception('<h2>This should be the first output.</h2>');
> }
> catch (Exception $ex) {
> exit('<h2>Exception:</h2>' . $ex->getMessage());
> }
>
>
> -- or --
>
>
> <?
> try {
> ob_start();
> echo '<h1>You should not see this!</h1>';
> throw new Exception('<h2>This should be the first output.</h2>');
> }
> catch (Exception $ex) {
> $buffer = ob_get_clean();
> exit('<h2>Exception:</h2>' . $ex->getMessage());
> }
>
> Or you can create a custom exception class, and add the above
functionality in the constructor. Either clean the buffer, or save it within
the exception of needed. That way you won't have to bother with ob, if you
use this often.
>
> --
> Thanks!
> -Shawn
> http://www.spidean.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Alpar Torok
--- End Message ---
--- Begin Message ---
2009/2/3 Thodoris <t...@kinetix.gr>:
> I was wondering if there is way to find out what is the time that every
> day ends? I am planning to add this to the first page on an interface I am
> developing.
Most days end at midnight, but there may be some exceptions ;-)
Seriously though, not really sure what you're asking.
-Stuart
--
http://stut.net/
--- End Message ---
--- Begin Message ---
> Hi gang,
> I was wondering if there is way to find out what is the time that every
> day ends? I am planning to add this to the first page on an interface I am
> developing.
>
> --
> Thodoris
Doesn't every day end at 23:59:59? the next second would be 00:00:00...the
beginning of a new day! :)
So to put this time into a variable you could do:
$end_of_day = mktime(23, 59, 59, date("m"), date("d"), date("Y");
that will give you the value for today (mm/dd/yyyy) at 23:59:59.
--- End Message ---
--- Begin Message ---
2009/2/3 Thodoris <t...@kinetix.gr>:
I was wondering if there is way to find out what is the time that every
day ends? I am planning to add this to the first page on an interface I am
developing.
Most days end at midnight, but there may be some exceptions ;-)
Seriously though, not really sure what you're asking.
-Stuart
:-)
Sorry Stuart I should have made it more clear. I meant the time that the
sun goes down and the dark night finally comes.
The time that a vampire can safely go for a pizza without burning himself.
Of course Blade is an exception thrown out of the blue.
--
Thodoris
--- End Message ---
--- Begin Message ---
Thodoris wrote:
> Hi gang,
> I was wondering if there is way to find out what is the time that
> every day ends? I am planning to add this to the first page on an
> interface I am developing.
>
I'm not sure that I understand, but I'm pretty sure that every day ends
on 23:59:59.
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Try:
echo date("H:i:s", mktime(23-date("H"), 59-date("i"), 59-date("s"));
-----Mensagem original-----
De: Thodoris [mailto:t...@kinetix.gr]
Enviada em: terça-feira, 3 de fevereiro de 2009 14:38
Para: Stuart
Cc: php-gene...@lists.php.net
Assunto: Re: [PHP] calculate the time that day ends
> 2009/2/3 Thodoris <t...@kinetix.gr>:
>
>> I was wondering if there is way to find out what is the time that every
>> day ends? I am planning to add this to the first page on an interface I am
>> developing.
>>
>
> Most days end at midnight, but there may be some exceptions ;-)
>
> Seriously though, not really sure what you're asking.
>
> -Stuart
>
>
:-)
Sorry Stuart I should have made it more clear. I meant the time that the
sun goes down and the dark night finally comes.
The time that a vampire can safely go for a pizza without burning himself.
Of course Blade is an exception thrown out of the blue.
--
Thodoris
--- End Message ---
--- Begin Message ---
Thodoris wrote:
>
>> 2009/2/3 Thodoris <t...@kinetix.gr>:
>>
>>> I was wondering if there is way to find out what is the time that
>>> every
>>> day ends? I am planning to add this to the first page on an
>>> interface I am
>>> developing.
>>>
>>
>> Most days end at midnight, but there may be some exceptions ;-)
>>
>> Seriously though, not really sure what you're asking.
>>
>> -Stuart
>>
>>
>
> :-) Sorry Stuart I should have made it more clear. I meant the time that
> the sun goes down and the dark night finally comes.
> The time that a vampire can safely go for a pizza without burning himself.
> Of course Blade is an exception thrown out of the blue.
>
STFW
http://www.google.com/search?q=calculate+sunset+formula
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Try:
echo date("H:i:s", mktime(23-date("H"), 59-date("i"), 59-date("s"));
This is I guess how much time we have to reach midnight. But the
question is how to calculate the time that sun stops showing its
refreshing light.
BTW try not to top post
--
Thodoris
--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Thodoris wrote:
>>> 2009/2/3 Thodoris <t...@kinetix.gr>:
>>>
>>>> I was wondering if there is way to find out what is the time that
>>>> every
>>>> day ends? I am planning to add this to the first page on an
>>>> interface I am
>>>> developing.
>>>>
>>> Most days end at midnight, but there may be some exceptions ;-)
>>>
>>> Seriously though, not really sure what you're asking.
>>>
>>> -Stuart
>>>
>>>
>> :-) Sorry Stuart I should have made it more clear. I meant the time that
>> the sun goes down and the dark night finally comes.
>> The time that a vampire can safely go for a pizza without burning himself.
>> Of course Blade is an exception thrown out of the blue.
>>
>
> STFW
> http://www.google.com/search?q=calculate+sunset+formula
>
Wow, also: http://www.google.com/search?q=php+calculate+sunset
Yields this gem: http://www.w3schools.com/php/func_date_sunset.asp
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Shawn McKenzie wrote:
>> Thodoris wrote:
>>>> 2009/2/3 Thodoris <t...@kinetix.gr>:
>>>>
>>>>> I was wondering if there is way to find out what is the time that
>>>>> every
>>>>> day ends? I am planning to add this to the first page on an
>>>>> interface I am
>>>>> developing.
>>>>>
>>>> Most days end at midnight, but there may be some exceptions ;-)
>>>>
>>>> Seriously though, not really sure what you're asking.
>>>>
>>>> -Stuart
>>>>
>>>>
>>> :-) Sorry Stuart I should have made it more clear. I meant the time that
>>> the sun goes down and the dark night finally comes.
>>> The time that a vampire can safely go for a pizza without burning himself.
>>> Of course Blade is an exception thrown out of the blue.
>>>
>> STFW
>> http://www.google.com/search?q=calculate+sunset+formula
>>
>
> Wow, also: http://www.google.com/search?q=php+calculate+sunset
>
> Yields this gem: http://www.w3schools.com/php/func_date_sunset.asp
>
Whooa. I thought that was actual code for the function, but it appears
that it is a PHP5 function! Who would've thunk?
http://php.net/date_sunset
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
Thodoris wrote:
2009/2/3 Thodoris <t...@kinetix.gr>:
I was wondering if there is way to find out what is the time that
every
day ends? I am planning to add this to the first page on an
interface I am
developing.
Most days end at midnight, but there may be some exceptions ;-)
Seriously though, not really sure what you're asking.
-Stuart
:-) Sorry Stuart I should have made it more clear. I meant the time that
the sun goes down and the dark night finally comes.
The time that a vampire can safely go for a pizza without burning himself.
Of course Blade is an exception thrown out of the blue.
STFW
http://www.google.com/search?q=calculate+sunset+formula
Wow, also: http://www.google.com/search?q=php+calculate+sunset
Yields this gem: http://www.w3schools.com/php/func_date_sunset.asp
Thanks Shawn this could make a good start:
http://www.phpclasses.org/browse/package/2642.html
--
Thodoris
--- End Message ---
--- Begin Message ---
Am Dienstag, 3. Februar 2009 schrieb Shawn McKenzie:
> I'm not sure that I understand, but I'm pretty sure that every day
> ends on 23:59:59.
No, for some people only most days :-) :
http://en.wikipedia.org/wiki/Leap_second
some days end on 23:59:60 which is not the same as 00:00:00.
Ralf
--
Miss Wormwood: What state do you live in?
Calvin: Denial.
Miss Wormwood: I don't suppose I can argue with that...
--- End Message ---
--- Begin Message ---
At 11:36 AM -0500 2/3/09, Dan Shirah wrote:
Doesn't every day end at 23:59:59? the next second would be 00:00:00...the
beginning of a new day! :)
Splitting hairs. December 31, 2008 had two 23:59:59 -- it was a leap
second for that year.
My grand-kids, being the nerds that they are counted the New Year down like so:
10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1, Happy New Year!
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--- End Message ---
--- Begin Message ---
Shawn McKenzie a écrit :
STFW
That's not so fair. If Thodoris ask about day end, it is obvious he's
wrong with the word. Wrong because he isn't mastering english. So,
without the good word (sunset), he can't find. So please don't bash us
when we appear silly !
--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
Seeking for a position <http://lupusmic.org/pro/>
--- End Message ---
--- Begin Message ---
On Tue, 2009-02-03 at 12:51 +0100, Jochem Maas wrote:
> Edmund Hertle schreef:
> > 2009/2/3 Daevid Vincent <dae...@daevid.com>
> >
> >> Is there a way to create a new property via PHP 5.2.4?
> >>
> >> I get a hash back from an authentication server. I'm not guaranteed that
> >> someone in another department won't add new key/values to the returned
> >> hash/array. I'm trying to work around that part gracefully so that the
> >> code doesn't blow up on a customer in such an event. The main try/catch
> >> will suppress errors already, but I thought it would be nice to be able
> >> to handle this stuff automatically rather than constantly updating a
> >> User.class.php file all the time.
> >>
> >> "creating new property this->oraclecustomerid with 1122"
> >>
> >> but when I try to set the value with the $this->$pkey = $value;
> >>
> >> It triggers __call() which then triggers __set() which throws my
> >> BadProperty exception.
> >>
> >> How come $this->$pkey = $value isn't creating/setting a property?
> >> Or how do I do something like create_property($this, $pkey);
> >> so that I can then set it via $this->oraclecustomerid = 1122 or
> >> $this->set_oraclecustomerid(1122) ???
> >>
> >> <?php
> >> function load_from_user_data($user_data)
> >> {
> >> //now loop through the rest of the user_data array and assign via a
> >> set_foo() method
> >> foreach ($user_data as $key => $value)
> >> {
> >> //try
> >> {
> >> $pkey = strtolower($key);
> >> //[dv] this is sort of a hack to
> >> "automatically" create a new
> >> property/variable
> >> // for 'new' hashes key/values we
> >> may not know about.
> >> // It's really designed to supress
> >> errors and they really should
> >> be added to this User.class.php properly.
> >> if ( !property_exists($this, $pkey) )
> >> {
> >> echo "creating new property
> >> this->$pkey with $value<br>\n";
> >> $this->$pkey = $value; //THIS BLOWS
> >> UP ON THE __set()
> >> echo "this->$pkey = ".$this->$pkey;
> >> }
> the question is what is __set() doing, if it's throwing an exception
> for undefined properties then obviously it with 'blow up'.
But why should __set() even be called if I'm accessing the property
directly? This seems stupid.
$this->oraclecustomerid = 1122;
should NOT be the same as
$this->set_oraclecustomerid(1122);
The second one I agree should call __set(), but the first one should NOT
be triggering __call() or __set()
> >
> >
> >
> >> else
> >> {
> >> $class_variable = 'set_'.$pkey;
> >> $this->$class_variable($value);
> >> unset($user_data[$key]);
> >> }
> >> }
> >> //catch (Exception $e)
> >> {
> >> //echo $e->getMessage()."\n";
> >> }
> >> }
> >>
> >> //should new fields be returned in the $user_data that are
> >> not
> >> accounted for above...
> >> if ($_SESSION['DEVELOPMENT'] && count($user_data))
> >> {
> >> echo "<!-- Unaccounted for user_data hashes. Please
> >> add these into
> >> User.class.php:\n";
> >> var_dump($user_data);
> >> echo "-->";
> >> }
> >>
> >> //THESE TWO LINES FATAL ERROR ON THE __get():
> >> echo "this->oraclecustomerid = ".$this->oraclecustomerid;
> >> echo "this->get_oraclecustomerid() =
> >> ".$this->get_oraclecustomerid();
> >> }
> >> ?>
> >>
> >
>
--- End Message ---
--- Begin Message ---
On Tue, 2009-02-03 at 08:30 +0100, Edmund Hertle wrote:
> 2009/2/3 Daevid Vincent <dae...@daevid.com>
>
> > Is there a way to create a new property via PHP 5.2.4?
> >
> > I get a hash back from an authentication server. I'm not guaranteed that
> > someone in another department won't add new key/values to the returned
> > hash/array. I'm trying to work around that part gracefully so that the
> > code doesn't blow up on a customer in such an event. The main try/catch
> > will suppress errors already, but I thought it would be nice to be able
> > to handle this stuff automatically rather than constantly updating a
> > User.class.php file all the time.
> >
> > "creating new property this->oraclecustomerid with 1122"
> >
> > but when I try to set the value with the $this->$pkey = $value;
> >
> > It triggers __call() which then triggers __set() which throws my
> > BadProperty exception.
> >
> > How come $this->$pkey = $value isn't creating/setting a property?
> > Or how do I do something like create_property($this, $pkey);
> > so that I can then set it via $this->oraclecustomerid = 1122 or
> > $this->set_oraclecustomerid(1122) ???
> >
> > <?php
> > function load_from_user_data($user_data)
> > {
> > //now loop through the rest of the user_data array and assign via a
> > set_foo() method
> > foreach ($user_data as $key => $value)
> > {
> > //try
> > {
> > $pkey = strtolower($key);
> > //[dv] this is sort of a hack to
> > "automatically" create a new
> > property/variable
> > // for 'new' hashes key/values we
> > may not know about.
> > // It's really designed to supress
> > errors and they really should
> > be added to this User.class.php properly.
> > if ( !property_exists($this, $pkey) )
> > {
> > echo "creating new property
> > this->$pkey with $value<br>\n";
> > $this->$pkey = $value; //THIS BLOWS
> > UP ON THE __set()
> > echo "this->$pkey = ".$this->$pkey;
> > }
> Hey,
> well, $this->$pkey is wrong syntax. Try $this->pkey = $value
No Eddie, it's one of the beautiful, simple and powerful things about
PHP.
http://www.php.net/manual/en/language.variables.variable.php
As I loop over the hash, i am TRYING to create a new class property of
the key and assigning it the value.
$pkey is basically the hash's $key in mixed case, forced to lowercase.
You can do this for variables and for functions/methods too. This is a
'factory'. I've used it for example for parsing an XML file and
operating on the data within various 'blocks' by reading the <block
name="foo" value="bar"> and then executing $$name($value).
Thanks for trying though. ;-)
> >
> > else
> > {
> > $class_variable = 'set_'.$pkey;
> > $this->$class_variable($value);
> > unset($user_data[$key]);
> > }
> > }
> > //catch (Exception $e)
> > {
> > //echo $e->getMessage()."\n";
> > }
> > }
> >
> > //should new fields be returned in the $user_data that are
> > not
> > accounted for above...
> > if ($_SESSION['DEVELOPMENT'] && count($user_data))
> > {
> > echo "<!-- Unaccounted for user_data hashes. Please
> > add these into
> > User.class.php:\n";
> > var_dump($user_data);
> > echo "-->";
> > }
> >
> > //THESE TWO LINES FATAL ERROR ON THE __get():
> > echo "this->oraclecustomerid = ".$this->oraclecustomerid;
> > echo "this->get_oraclecustomerid() =
> > ".$this->get_oraclecustomerid();
> > }
> > ?>
> >
--- End Message ---
--- Begin Message ---
the question is what is __set() doing, if it's throwing an exception
for undefined properties then obviously it with 'blow up'.
But why should __set() even be called if I'm accessing the property
directly? This seems stupid.
$this->oraclecustomerid = 1122;
should NOT be the same as
$this->set_oraclecustomerid(1122);
The second one I agree should call __set(), but the first one should NOT
be triggering __call() or __set()
Yes it should.
http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members
__set() is run when writing data to inaccessible members.
if it's a protected/private variable, it'll call __set.
If it's a variable that doesn't exist, it'll call __set.
--
Postgresql & php tutorials
http://www.designmagick.com/
--- End Message ---
--- Begin Message ---
Hi,
I now have a demo site available so you can easily monitor the projects
progress. The site is updated daily with the svn checkins.
http://www.jotbug.org
The source is still hosted at http://jotbug.googlecode.com
Regards,
- Robert
rcastley wrote:
>
> Hi,
>
> I am looking (begging!) for help/testing/feedback etc etc etc on my JotBug
> project
>
> http://jotbug.googlecode.com
>
> So far, I have the following implemented:
>
> Wiki
> - Syntax is Textile
> - Add
> - Edit
> - Preview
> - Delete
> - Attachments (upload/view)
> - Code highlighting using Geshi
> - Macro Plugins
>
> Tracker
> - Add
> - List
> - View
>
> Authentication
> - Dummy Login
>
> SCM
> - SVN browser
> - SVN viewer - code highlighting using GeSHi
>
> Mutiple Project Listing
>
> I am working on e-mail notification and user profile/account settings at
> the moment.
>
> Thanks in advance.
>
> - Robert
>
--
View this message in context:
http://www.nabble.com/-PROJECT-HELP----JotBug---A-Project-Management---Issue-Tracker-written-100--with-Zend-Framework-tp21696826p21819830.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
I'm trying to send vars via POST somehow. Is this possible?
Currently I'm doing
header("Location: http://domain/index.php?var=3");
but, want to send POST or some other method that doesn't stick with the session.
Thanks, T
--- End Message ---
--- Begin Message ---
TS wrote:
> I'm trying to send vars via POST somehow. Is this possible?
>
> Currently I'm doing
>
> header("Location: http://domain/index.php?var=3");
>
> but, want to send POST or some other method that doesn't stick with the
> session.
>
> Thanks, T
>
>
No, it is not possible. You will need to look into cURL or something else.
But it cannot be done via the header() function.
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--- End Message ---
--- Begin Message ---
On Tue, Feb 3, 2009 at 2:54 PM, Jim Lucas <li...@cmsws.com> wrote:
> TS wrote:
>> I'm trying to send vars via POST somehow. Is this possible?
>>
>> Currently I'm doing
>>
>> header("Location: http://domain/index.php?var=3");
>>
>> but, want to send POST or some other method that doesn't stick with the
>> session.
>>
>> Thanks, T
>>
>>
>
> No, it is not possible. You will need to look into cURL or something else.
>
> But it cannot be done via the header() function.
>
> --
> Jim Lucas
>
> "Some men are born to greatness, some achieve greatness,
> and some have greatness thrust upon them."
>
> Twelfth Night, Act II, Scene V
> by William Shakespeare
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
You could always create major overhead and stick it in the database. Ha...
--
Kyle Terry | www.kyleterry.com
Help kick start VOOM (Very Open Object Model) for a library of PHP classes.
http://www.voom.me | IRC EFNet #voom
--- End Message ---
--- Begin Message ---
On Tue, Feb 3, 2009 at 2:54 PM, Jim Lucas <li...@cmsws.com> wrote:
> TS wrote:
> > I'm trying to send vars via POST somehow. Is this possible?
> >
> > Currently I'm doing
> >
> > header("Location: http://domain/index.php?var=3");
> >
> > but, want to send POST or some other method that doesn't stick with the
> session.
> >
> > Thanks, T
> >
> >
>
> No, it is not possible. You will need to look into cURL or something else.
>
> But it cannot be done via the header() function.
>
I second that you need to use curl:
$header = array(
"MIME-Version"=>"1.0",
"Content-type"=>"text/html; charset=utf-8"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->elqPosturl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, $this->curlOptTimeOut);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1);
curl_setopt($ch, CURLOPT_PROXY, $this->proxyServer);
curl_setopt($ch, CURLOPT_PROXYPORT, $this->proxyPort);
curl_setopt($ch, CURLOPT_POSTFIELDS, $inputArray);
curl_setopt($ch, CURLOPT_USERAGENT, 'MSIE');
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_HEADER, 1);
$data = curl_exec($ch);
Thanks,
V
--- End Message ---
--- Begin Message ---
On Wed, 2009-02-04 at 08:58 +1100, Chris wrote:
> >> the question is what is __set() doing, if it's throwing an exception
> >> for undefined properties then obviously it with 'blow up'.
> >
> >
> >
> > But why should __set() even be called if I'm accessing the property
> > directly? This seems stupid.
> >
> > $this->oraclecustomerid = 1122;
> >
> > should NOT be the same as
> >
> > $this->set_oraclecustomerid(1122);
> >
> > The second one I agree should call __set(), but the first one should NOT
> > be triggering __call() or __set()
>
> Yes it should.
>
> http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members
>
> __set() is run when writing data to inaccessible members.
>
> if it's a protected/private variable, it'll call __set.
>
> If it's a variable that doesn't exist, it'll call __set.
>
Let me rephrase that. I see now that it is designed that way, but I
think the logic is erroneous. While I'm sure this argument/discussion
is all for naught now, I believe that a straight assignment of a value
to a variable, SHOULD NOT do any behind the scenes magic __set(). It
should just do it. Otherwise, what's the point of being able to "set" a
property/variable both ways? One gives no benefit over the other and as
illustrated decreases flexibility. It appears it will work if I change
my property to public, but I don't want them exposed like that. *sigh*
Bottom line is there should be a create_property($name, $value = null,
$type = 'protected') function/method that I can call to do what I'm
trying to do.
I assume unset($this->foo); works. So therefore, I can check for
existence of a property, and consequently remove a property, but I
cannot create a property.
--- End Message ---
--- Begin Message ---
On Tue, Feb 3, 2009 at 4:19 PM, Daevid Vincent <dae...@daevid.com> wrote:
> On Wed, 2009-02-04 at 08:58 +1100, Chris wrote:
>
> > >> the question is what is __set() doing, if it's throwing an exception
> > >> for undefined properties then obviously it with 'blow up'.
> > >
> > >
> > >
> > > But why should __set() even be called if I'm accessing the property
> > > directly? This seems stupid.
> > >
> > > $this->oraclecustomerid = 1122;
> > >
> > > should NOT be the same as
> > >
> > > $this->set_oraclecustomerid(1122);
> > >
> > > The second one I agree should call __set(), but the first one should
> NOT
> > > be triggering __call() or __set()
> >
> > Yes it should.
> >
> >
> http://www.php.net/manual/en/language.oop5.overloading.php#language.oop5.overloading.members
> >
> > __set() is run when writing data to inaccessible members.
> >
> > if it's a protected/private variable, it'll call __set.
> >
> > If it's a variable that doesn't exist, it'll call __set.
> >
>
>
> Let me rephrase that. I see now that it is designed that way, but I
> think the logic is erroneous. While I'm sure this argument/discussion
> is all for naught now, I believe that a straight assignment of a value
> to a variable, SHOULD NOT do any behind the scenes magic __set(). It
> should just do it. Otherwise, what's the point of being able to "set" a
> property/variable both ways? One gives no benefit over the other and as
> illustrated decreases flexibility. It appears it will work if I change
> my property to public, but I don't want them exposed like that. *sigh*
>
> Bottom line is there should be a create_property($name, $value = null,
> $type = 'protected') function/method that I can call to do what I'm
> trying to do.
>
> I assume unset($this->foo); works. So therefore, I can check for
> existence of a property, and consequently remove a property, but I
> cannot create a property.
wow, obviously you can create properties at runtime. if you want direct
access to property assignment, dont define __set() for that class. if you
want to override this assignment, then define __set() for that class, pretty
simple..
and property creation / assignment is essentially the same thing, since all
properties must store a value. when you 'create' a property in php w/o
explicitly giving it a value the default value is NULL.
i recommend that if you want to keep __set() defined in this class you
mentioned, and not have the melt-down b/c you have some check to see if the
property exists, you can just define another method, createOrSet($property,
$value), something to that effect, which will ignore the step about
verifying the property already exists.
-nathan
--- End Message ---
--- Begin Message ---
Got it, thanks. I see that PHP is unlike many other OO language, it's a
little stricter in scoping.
--
View this message in context:
http://www.nabble.com/Visibility-of-class-constant-tp21803985p21823751.html
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
Chris Scott wrote:
> You cannot access a class constant just by the constant name. See
> http://docs.php.net/manual/en/language.oop5.paamayim-nekudotayim.php.
Holy crap! Why can't it just be :: or double colon!
--
Thanks!
-Shawn
http://www.spidean.com
--- End Message ---