[PHP] How does one reply to messages on this list?

2010-12-16 Thread Sam Smith
If I just hit 'Reply' I'll send my reply to the individual who created the
message. If I hit 'Reply All' my reply will be sent to: Govinda <
govinda.webdnat...@gmail.com>, PHP-General List 
and the creator of the message.

Neither option seems correct. What's up with that?

Thanks


[PHP] Re: How does one reply to messages on this list?

2010-12-16 Thread Jo�o C�ndido de Souza Neto
As I use outlook, I just hit "Reply to Group.

-- 
João Cândido de Souza Neto

"Sam Smith"  escreveu na mensagem 
news:aanlktikarnvhn-gzexe8qedngeewgqqgs7cpchzav...@mail.gmail.com...
> If I just hit 'Reply' I'll send my reply to the individual who created the
> message. If I hit 'Reply All' my reply will be sent to: Govinda <
> govinda.webdnat...@gmail.com>, PHP-General List 
> 
> and the creator of the message.
>
> Neither option seems correct. What's up with that?
>
> Thanks
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Daniel Brown
On Thu, Dec 16, 2010 at 06:44, Sam Smith  wrote:
> If I just hit 'Reply' I'll send my reply to the individual who created the
> message. If I hit 'Reply All' my reply will be sent to: Govinda <
> govinda.webdnat...@gmail.com>, PHP-General List 
> and the creator of the message.
>
> Neither option seems correct. What's up with that?

With our lists (the PHP lists, that is), like many others, we ask
that you always hit "Reply-All" unless you intend to reply personally
to an individual.  In general, the folks to whom you're replying will
be subscribers to the list to which you're writing anyway, and
[almost] all modern email clients and services will intelligently
discard duplicate messages if it's detected to be from a mailing list
or similar method of distribution.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP 5.2.16 Released!

2010-12-16 Thread Ilia Alshanetsky
The PHP development team would like to announce the immediate
availability of PHP 5.2.16. This release marks the end of support for
PHP 5.2. All users of PHP 5.2 are encouraged to upgrade to PHP 5.3.

This release focuses on addressing a regression in open_basedir
implementation introduced in 5.2.15 in addition to fixing a crash
inside PDO::pgsql on data retrieval when the server is down. All users
who have upgraded to 5.2.15 and are utilizing open_basedir are
strongly encouraged to upgrade to 5.2.16 or 5.3.4.

For a full list of changes in PHP 5.2.16, see the ChangeLog on
. For source downloads please
visit our downloads page on , Windows
binaries can be found on .

Ilia Alshanetsky
5.2 Release Master

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Nicholas Kell

Couldn't we just have a reply-to address for the list in the header of the 
email? So all a fella had to do was hit reply, and it would work?

This is how the Apache and the MySQL list works. The PHP list is the only list 
that I have to manually edit my reply every time.

For example, I hit reply all on this message, it is now replying to Daniel, and 
CC'ing Sam and the php-general.

On Dec 16, 2010, at 5:55 AM, Daniel Brown wrote:

> On Thu, Dec 16, 2010 at 06:44, Sam Smith  wrote:
>> If I just hit 'Reply' I'll send my reply to the individual who created the
>> message. If I hit 'Reply All' my reply will be sent to: Govinda <
>> govinda.webdnat...@gmail.com>, PHP-General List 
>> and the creator of the message.
>> 
>> Neither option seems correct. What's up with that?
> 
>With our lists (the PHP lists, that is), like many others, we ask
> that you always hit "Reply-All" unless you intend to reply personally
> to an individual.  In general, the folks to whom you're replying will
> be subscribers to the list to which you're writing anyway, and
> [almost] all modern email clients and services will intelligently
> discard duplicate messages if it's detected to be from a mailing list
> or similar method of distribution.
> 
> -- 
> 
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Jay Blanchard
[snip]
Couldn't we just have a reply-to address for the list in the header of
the email? So all a fella had to do was hit reply, and it would work?

This is how the Apache and the MySQL list works. The PHP list is the
only list that I have to manually edit my reply every time.

For example, I hit reply all on this message, it is now replying to
Daniel, and CC'ing Sam and the php-general.
[/snip]

Oh crap, here we go again. STFA, this comes up a couple of times an
annum.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Daniel Brown
On Thu, Dec 16, 2010 at 09:19, Nicholas Kell  wrote:
>
> Couldn't we just have a reply-to address for the list in the header of the 
> email? So all a fella had to do was hit reply, and it would work?

The easiest (and most accurate) answer: no.

> This is how the Apache and the MySQL list works. The PHP list is the only 
> list that I have to manually edit my reply every time.

Actually, MySQL does not work that way.  And it's been several
years since I posted to any of the Apache lists, but I do seem to
remember that being the case there.  It was annoying.  It's so much
more intuitive to know that hitting "Reply" goes to the individual,
whereas "Reply-All" will, as the option suggests, reply to all.

> For example, I hit reply all on this message, it is now replying to Daniel, 
> and CC'ing Sam and the php-general.

Correct but what's the problem?  We're all only receiving one
copy of the email, I'm sure.  We've done it this way from the
beginning, and have no intention of changing it.

-- 

Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Nicholas Kell

On Dec 16, 2010, at 8:26 AM, Daniel Brown wrote:

> On Thu, Dec 16, 2010 at 09:19, Nicholas Kell  wrote:
>> 
>> Couldn't we just have a reply-to address for the list in the header of the 
>> email? So all a fella had to do was hit reply, and it would work?
> 
>The easiest (and most accurate) answer: no.

Ok.

> 
>> This is how the Apache and the MySQL list works. The PHP list is the only 
>> list that I have to manually edit my reply every time.
> 
>Actually, MySQL does not work that way.  And it's been several
> years since I posted to any of the Apache lists, but I do seem to
> remember that being the case there.  It was annoying.  It's so much
> more intuitive to know that hitting "Reply" goes to the individual,
> whereas "Reply-All" will, as the option suggests, reply to all.

I apologize, you are correct MySQL does not.

I guess to me it seemed intuitive that replying went to the list, considering 
the list is where it (should have) came from. The sender only being a secondary 
recipient. Also, knowing that I will more than likely never want to send 
anything directly to the sender anyway. 

> 
>> For example, I hit reply all on this message, it is now replying to Daniel, 
>> and CC'ing Sam and the php-general.
> 
>Correct but what's the problem?  We're all only receiving one
> copy of the email, I'm sure.  We've done it this way from the
> beginning, and have no intention of changing it.
> 


 "We've done it this way from the
beginning" says it all. 

No problem. I am not asking for the world to change. In fact I am not asking 
for anything at all. I was just bringing to light a few things that I thought 
were valuable to the OP's message.

I am using the latest Mac Mail on 10.6, and I do actually receive two copies of 
the message whenever someone replies all. That is pretty annoying, but it's not 
a big deal. I guess my client is not intelligently discarding duplicate 
messages. Thank goodness it's not though, or I wouldn't know how to 
repetitively test email sending when working on projects.

Every time that I replied to a message, I always took out the senders email and 
entered the php-general email, but perhaps I was breaking protocol? I guess I 
thought I was just being considerate to the sender, by not sending duplicate 
messages. From now on I will hit reply all, and be done with it.

Bottom line - I am glad my email client gives me all the messages that are sent 
to it, and nothing is going to (or needs to) change, so I suppose that this 
message will, by some be considered spam.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Paul M Foster
On Thu, Dec 16, 2010 at 08:19:52AM -0600, Nicholas Kell wrote:

> 
> Couldn't we just have a reply-to address for the list in the header of
> the email? So all a fella had to do was hit reply, and it would work?
> 
> This is how the Apache and the MySQL list works. The PHP list is the
> only list that I have to manually edit my reply every time.
> 
> For example, I hit reply all on this message, it is now replying to
> Daniel, and CC'ing Sam and the php-general.

Lists to which one does not have to be subscribed to post are often set
up this way. My local Linux users group list does it the way you
suggest, because it's a closed list.

But the originators of any list set up things the way they believe is
best, and there's no benefit to arguing about it. There are heated
arguments about both ways of setting up a list, just like there are with
top- and bottom-posting. The final authority is the list admin for the
list you're posting to. And he's generally unsympathetic to opposing
viewpoints.

Paul

-- 
Paul M. Foster

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Nicholas Kell

On Dec 16, 2010, at 9:28 AM, Paul M Foster wrote:

> On Thu, Dec 16, 2010 at 08:19:52AM -0600, Nicholas Kell wrote:
> 
>> 
>> Couldn't we just have a reply-to address for the list in the header of
>> the email? So all a fella had to do was hit reply, and it would work?
>> 
>> This is how the Apache and the MySQL list works. The PHP list is the
>> only list that I have to manually edit my reply every time.
>> 
>> For example, I hit reply all on this message, it is now replying to
>> Daniel, and CC'ing Sam and the php-general.
> 
> Lists to which one does not have to be subscribed to post are often set
> up this way. My local Linux users group list does it the way you
> suggest, because it's a closed list.
> 
> But the originators of any list set up things the way they believe is
> best, and there's no benefit to arguing about it. There are heated
> arguments about both ways of setting up a list, just like there are with
> top- and bottom-posting. The final authority is the list admin for the
> list you're posting to. And he's generally unsympathetic to opposing
> viewpoints.

Sorry if I came off as argumentative, I didn't intend for that. I absolutely 
agree that the admin has last word and generally unsympathetic to opposing 
viewpoints. 

I am compliant. 

Let me give a formal apology to the list, for unscrewing the cap off the can of 
worms.

I apologize, and you wont hear another word from me on this. Since, it is, 
after all not a big deal to me. It's just an email list. This list has brought 
better things to the table for many people than chattering about email list 
preferences.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Govinda
Let me give a formal apology to the list, for unscrewing the cap off  
the can of worms.


NIcholas, just so you know you are appreciated for asking the Q in the  
first place:
..some of us are new here.. or only lurk enough to catch some of the  
threads... and so I was also missing some of the subtleties in how the  
list send copies to whom, and why.  Your Q, and the replies..  
clarified much.  Thank you!


-Govinda

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Daniel Molina Wegener
On Thursday 16 December 2010,
Sam Smith  wrote:

> If I just hit 'Reply' I'll send my reply to the individual who created
> the message. If I hit 'Reply All' my reply will be sent to: Govinda <
> govinda.webdnat...@gmail.com>, PHP-General List
>  and the creator of the message.
> 
> Neither option seems correct. What's up with that?

  If your MUA (or email client) is smart enough, it should have at least
"Reply", "Reply to Sender", "Reply to All" and "Reply to Mailing List".
Here I have all those options.

> 
> Thanks


Best regards,
-- 
Daniel Molina Wegener 
System Programmer & Web Developer
Phone: +56 (2) 979-0277 | Blog: http://coder.cl/


signature.asc
Description: This is a digitally signed message part.


Re: [PHP] How does one reply to messages on this list?

2010-12-16 Thread David Harkness
On Thu, Dec 16, 2010 at 8:09 AM, Daniel Molina Wegener  wrote:

> If your MUA (or email client) is smart enough, it should have at least
>
> "Reply", "Reply to Sender", "Reply to All" and "Reply to Mailing List".
>

To which my client adds "Reply to /dev/null", "Reply to Those Who Actually
Care", and "Reply to Al Gore". It's much smarter than the average MUA.

David


RE: [PHP] How does one reply to messages on this list?

2010-12-16 Thread Jay Blanchard
[snip]
To which my client adds "Reply to /dev/null", "Reply to Those Who
Actually
Care", and "Reply to Al Gore". It's much smarter than the average MUA.
[/snip]

It could be argued that replying to Al Gore might not be all that smart.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Kris Deugau
I'm in the process of migrating customer websites off an old legacy 
server that's pushing EOL, and starting to show hardware failures.


One site is throwing errors on what, so far as I can tell, should be 
perfectly working code.


The original code works fine on both CentOS 3 (PHP 4.3.2) and CentOS 4 
(4.3.9);  the "new" server is still a bit outdated (Debian etch plus 
some backports and updates from lenny;  PHP 5.2.0).


The site was designed by staff at a previous hosting company and uses a 
combination of the Fusebox app framework (which seems to work OK, after 
a few relatively minor fixes) and a custom OOP structure.


I'm not really sure what the actual problem is, but I've reached the 
point where this:



  class SelectBoxOption extends Tag {
function SelectBoxOption($name, $value, $selected=false) {
  parent::Tag("option", $name);
  $this->addAttribute("value", $value);
  if($selected) {
$this->addAttribute("selected", '', false);
  }
if ($name == "") { echo "   missing name!\n"; }
//  else { print "   name $name\n"; }
if ($value == "") { echo "   missing value!\n"; }
}


will parse and execute, but:
- the page will contain "missing value!" for each  in the 
 this is generating

- it will *not* contain "missing name!"
- the  tags in the final output don't have content or value 
(they should have both).


If I uncomment that else, I get:


adding option  with 
name 

 Catchable fatal error: Object of class SelectBoxOption could not be 
converted to string in 
/includes/classes/core/display/form/input/SelectBoxOption.php 
on line 12



I found the place this object is created, and added some debugging 
output before *and* after that call:



echo "adding option ".$row->$nameField." with ".
  $row->$valueField."\n";
$this->add(new SelectBoxOption($row->$nameField,
$row->$valueField, $selected));
echo "added option ".$row->$nameField." with ".
  $row->$valueField."\n";


which behaves correctly and spits out the name and value (retrieved from 
a database - thankfully I haven't had to track *that* down... yet).


Can anyone explain why a string passed by value (apparently) would 
suddenly mutate into a SelectBoxOption object?  I've confirmed that this 
is exactly what happens by adding this:



if (is_a($name,'SelectBoxOption')) {
  print "name isn't a SelectBoxOption, silly rabbit!\n";
}


as the very next set of lines after "function SelectBoxOption(".

I wondered while typing this if $name and $value might have ended up as 
special variables somewhere, but renaming them with an opt_ prefix 
didn't change anything.


-kgd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Tommy Pham
> -Original Message-
> From: Kris Deugau [mailto:kdeu...@vianet.ca]
> Sent: Thursday, December 16, 2010 11:57 AM
> To: php-general@lists.php.net
> Subject: [PHP] String passed to object constructor turning into an
instance of
> that object?
> 
> I'm in the process of migrating customer websites off an old legacy server
> that's pushing EOL, and starting to show hardware failures.
> 
> One site is throwing errors on what, so far as I can tell, should be
perfectly
> working code.
> 
> The original code works fine on both CentOS 3 (PHP 4.3.2) and CentOS 4
> (4.3.9);  the "new" server is still a bit outdated (Debian etch plus some
> backports and updates from lenny;  PHP 5.2.0).
> 
> The site was designed by staff at a previous hosting company and uses a
> combination of the Fusebox app framework (which seems to work OK, after
> a few relatively minor fixes) and a custom OOP structure.
> 
> I'm not really sure what the actual problem is, but I've reached the point
> where this:
> 
> 
>class SelectBoxOption extends Tag {
>  function SelectBoxOption($name, $value, $selected=false) {
>parent::Tag("option", $name);
>$this->addAttribute("value", $value);
>if($selected) {
>  $this->addAttribute("selected", '', false);
>}
> if ($name == "") { echo "   missing name!\n"; }
> //  else { print "   name $name\n"; }
> if ($value == "") { echo "   missing value!\n"; }
>  }
> 
> 
> will parse and execute, but:
> - the page will contain "missing value!" for each  in the
>  this is generating
> - it will *not* contain "missing name!"
> - the  tags in the final output don't have content or value
> (they should have both).
> 
> If I uncomment that else, I get:
> 
> 
> adding option  with 
>  name 
> 
>   Catchable fatal error: Object of class SelectBoxOption could not be
> converted to string in
> /includes/classes/core/display/form/input/SelectBoxOption.php
> on line 12
> 

What's the actual line #12 in the file SelectBoxOption.php?  The
SelectBoxOption code you presented has 11 lines unless it's a CNP error.

Regards,
Tommy

> 
> I found the place this object is created, and added some debugging
> output before *and* after that call:
> 
> 
> echo "adding option ".$row->$nameField." with ".
>$row->$valueField."\n";
> $this->add(new SelectBoxOption($row->$nameField,
>   $row->$valueField, $selected));
> echo "added option ".$row->$nameField." with ".
>$row->$valueField."\n";
> 
> 
> which behaves correctly and spits out the name and value (retrieved from
> a database - thankfully I haven't had to track *that* down... yet).
> 
> Can anyone explain why a string passed by value (apparently) would
> suddenly mutate into a SelectBoxOption object?  I've confirmed that this
> is exactly what happens by adding this:
> 
> 
> if (is_a($name,'SelectBoxOption')) {
>print "name isn't a SelectBoxOption, silly rabbit!\n";
> }
> 
> 
> as the very next set of lines after "function SelectBoxOption(".
> 
> I wondered while typing this if $name and $value might have ended up as
> special variables somewhere, but renaming them with an opt_ prefix
> didn't change anything.
> 
> -kgd
> 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Kris Deugau

Tommy Pham wrote:

   class SelectBoxOption extends Tag {
 function SelectBoxOption($name, $value, $selected=false) {
   parent::Tag("option", $name);
   $this->addAttribute("value", $value);
   if($selected) {
 $this->addAttribute("selected", '', false);
   }
if ($name == "") { echo "   missing name!\n"; }
//  else { print "   name $name\n"; }
if ($value == "") { echo "   missing value!\n"; }
 }


will parse and execute, but:
- the page will contain "missing value!" for each  in the
 this is generating
- it will *not* contain "missing name!"
- the  tags in the final output don't have content or value
(they should have both).

If I uncomment that else, I get:


adding option  with 
 name 

  Catchable fatal error: Object of class SelectBoxOption could not be
converted to string in
/includes/classes/core/display/form/input/SelectBoxOption.php
on line 12



What's the actual line #12 in the file SelectBoxOption.php?  The
SelectBoxOption code you presented has 11 lines unless it's a CNP error.


Whups, thought I noted that.  I trimmed a couple of blank lines;  line 
12 in the file is that print in the else.


I found trying to print $name triggers the same error anywhere in that 
function, too;  as I noted further down it seems the string that's 
passed in is getting mutated into an object.  (Whose missing toString 
function is what led me here - but it works fine in PHP 4.3...)


-kgd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 2:29 PM, Kris Deugau  wrote:

> Tommy Pham wrote:
>
>>   class SelectBoxOption extends Tag {
>>> function SelectBoxOption($name, $value, $selected=false) {
>>>   parent::Tag("option", $name);
>>>   $this->addAttribute("value", $value);
>>>   if($selected) {
>>> $this->addAttribute("selected", '', false);
>>>   }
>>> if ($name == "") { echo "   missing name!\n"; }
>>> //  else { print "   name $name\n"; }
>>> if ($value == "") { echo "   missing value!\n"; }
>>> }
>>>
>>>
>>> will parse and execute, but:
>>> - the page will contain "missing value!" for each  in the
>>>  this is generating
>>> - it will *not* contain "missing name!"
>>> - the  tags in the final output don't have content or value
>>> (they should have both).
>>>
>>> If I uncomment that else, I get:
>>>
>>>
>>> adding option  with 
>>> name 
>>>
>>>  Catchable fatal error: Object of class SelectBoxOption could not be
>>> converted to string in
>>> /includes/classes/core/display/form/input/SelectBoxOption.php
>>> on line 12
>>>
>>
>  What's the actual line #12 in the file SelectBoxOption.php?  The
>> SelectBoxOption code you presented has 11 lines unless it's a CNP error.
>>
>
> Whups, thought I noted that.  I trimmed a couple of blank lines;  line 12
> in the file is that print in the else.
>
> I found trying to print $name triggers the same error anywhere in that
> function, too;  as I noted further down it seems the string that's passed in
> is getting mutated into an object.  (Whose missing toString function is what
> led me here - but it works fine in PHP 4.3...)


Why not test for the type of $name at each point of interest in the
SelectBoxOption
constructor?  If you're passing a string value to the constructor it almost
has to be getting changed by the Tag constructor, right ?

  class SelectBoxOption extends Tag {
   function SelectBoxOption($name, $value, $selected=false) {

var_dump(is_string($name));

 parent::Tag("option", $name);

var_dump(is_string($name));

..
   }

-nathan


Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread Kris Deugau

Nathan Nobbe wrote:

Why not test for the type of $name at each point of interest in the
SelectBoxOption
constructor?  If you're passing a string value to the constructor it almost
has to be getting changed by the Tag constructor, right ?

  class SelectBoxOption extends Tag {
   function SelectBoxOption($name, $value, $selected=false) {

var_dump(is_string($name));

 parent::Tag("option", $name);

var_dump(is_string($name));


Ah, that gives...  well, it slightly alters the confusion.

Using var_dump(is_string($name)) gives...  two results?

bool(true)
bool(false)

And dumping $name itself gives:

string(8) "Abegweit"
 object(SelectBoxOption)#65 (5) { ["attributes"]=> array(1) { [0]=> 
object(TagAttribute)#66 (3) { ["name"]=> string(5) "value" ["value"]=> 
string(1) "4" ["hasValue"]=> bool(true) } } ["tagContent"]=> string(8) 
"Abegweit" ["tag"]=> string(6) "option" ["showEndTag"]=> bool(false) 
["children"]=> array(0) { } }


O_o

Just to confirm, I checked a test instance of the site on CentOS 4, with 
PHP 4.3, and I get one "bool(true)" for each  - not two as is 
happening with PHP 5.2.


-kgd

(I haven't worked with PHP for quite a while, and I never really spent a 
lot of time getting deep into complex data structures and object 
hierarchies like this when I was using it.  But this behaviour does NOT 
match what I know of passing values and object references around in any 
other language.)


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 3:21 PM, Kris Deugau  wrote:

> Nathan Nobbe wrote:
>
>> Why not test for the type of $name at each point of interest in the
>> SelectBoxOption
>> constructor?  If you're passing a string value to the constructor it
>> almost
>> has to be getting changed by the Tag constructor, right ?
>>
>>  class SelectBoxOption extends Tag {
>>   function SelectBoxOption($name, $value, $selected=false) {
>>
>> var_dump(is_string($name));
>>
>> parent::Tag("option", $name);
>>
>> var_dump(is_string($name));
>>
>
> Ah, that gives...  well, it slightly alters the confusion.
>
> Using var_dump(is_string($name)) gives...  two results?
>
> bool(true)
> bool(false)
>
> And dumping $name itself gives:
>
> string(8) "Abegweit"
>  object(SelectBoxOption)#65 (5) { ["attributes"]=> array(1) { [0]=>
> object(TagAttribute)#66 (3) { ["name"]=> string(5) "value" ["value"]=>
> string(1) "4" ["hasValue"]=> bool(true) } } ["tagContent"]=> string(8)
> "Abegweit" ["tag"]=> string(6) "option" ["showEndTag"]=> bool(false)
> ["children"]=> array(0) { } }
>
> O_o
>
> Just to confirm, I checked a test instance of the site on CentOS 4, with
> PHP 4.3, and I get one "bool(true)" for each  - not two as is
> happening with PHP 5.2.
>

probly something screwy going on w/ the old style of naming constructors.  2
things,

1. can you post the Tag constructor as it reads now?
2. try modifying Tag & SelectBoxOption to have __construct() instead of
Tag() & SelectBoxOption(), then call parent::__construct() from inside
of SelectBoxOption::__construct(); see if that clears up your problem under
5.2 (read: this will only be a partial solution as it only addresses one
child of Tag).


> -kgd
>
> (I haven't worked with PHP for quite a while, and I never really spent a
> lot of time getting deep into complex data structures and object hierarchies
> like this when I was using it.  But this behaviour does NOT match what I
> know of passing values and object references around in any other language.)
>

Probly because the term 'reference' in php means something rather different
than it does in say java for example.


Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread David Harkness
It's acting as if Tag's constructor a) declares $name as a reference using
&$name, and b) is assigning itself ($this) to $name for some (probably bad)
reason. That's the only way I can see that $name inside SelectBoxOption's
constructor could change from a string to an object.

A peek at Tag's constructor could really clear things up.

David


Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Kris Deugau

Nathan Nobbe wrote:

probly something screwy going on w/ the old style of naming constructors.  2
things,

1. can you post the Tag constructor as it reads now?


function Tag($tag='', $tagContent='') {
  $this->tagContent = $tagContent;
  $this->tag = $tag;
  $this->showEndTag = false;

  $this->attributes = array();
  $this->children = array();
}


2. try modifying Tag & SelectBoxOption to have __construct() instead of
Tag() & SelectBoxOption(), then call parent::__construct() from inside
of SelectBoxOption::__construct(); see if that clears up your problem under
5.2 (read: this will only be a partial solution as it only addresses one
child of Tag).


Mmm.  I hoped this would help, but all it seems to have done was cascade 
errors across the rest of Tag's object children.  :(  Copying the old 
constructor back in resolved that, but I'm not sure whether that 
reintroduces the root problem.


Other objects derived from Tag seem to work just fine;  I came into this 
chunk of the code trying to find out why a SelectBoxOption didn't seem 
to have a toString function - and then why trying to access what should 
be the value and name the same way as with other objects derived at some 
level from Tag blew up instead of working happily.


I'll try converting all of the constructors to your recommendation as 
above, but given that the problem is only happening with this one class, 
I'm not sure that will do much.


(A "don't-break-crusty-old-code" option for php.ini would be handy...)

The class hierarchy I've dug up so far looks like this (and appears to 
have been entirely defined by the original developer):


Object
  Fieldset
  RadioButtonGroup
  Tag
Column
FormObject
  FormInput
CheckBox
DateSelector
Editor
FileField
FormButton
HiddenField
PasswordField
RadioButton
SelectBox
  PopulatedSelectBox
RecursiveSelectBox
TextArea
TextField
  Form
Row
Table
SelectBoxOption

-kgd

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 4:04 PM, Kris Deugau  wrote:

> Nathan Nobbe wrote:
>
>> probly something screwy going on w/ the old style of naming constructors.
>>  2
>> things,
>>
>> 1. can you post the Tag constructor as it reads now?
>>
>
> function Tag($tag='', $tagContent='') {
>  $this->tagContent = $tagContent;
>  $this->tag = $tag;
>  $this->showEndTag = false;
>
>  $this->attributes = array();
>  $this->children = array();
>
> }
>

seems innocuous ..


>
>  2. try modifying Tag & SelectBoxOption to have __construct() instead of
>> Tag() & SelectBoxOption(), then call parent::__construct() from inside
>> of SelectBoxOption::__construct(); see if that clears up your problem
>> under
>> 5.2 (read: this will only be a partial solution as it only addresses one
>> child of Tag).
>>
>
> Mmm.  I hoped this would help, but all it seems to have done was cascade
> errors across the rest of Tag's object children.  :(


to be expected, but did it fix the problem w/ SelectBoxOption?


> Copying the old constructor back in resolved that, but I'm not sure whether
> that reintroduces the root problem.


> Other objects derived from Tag seem to work just fine;  I came into this
> chunk of the code trying to find out why a SelectBoxOption didn't seem to
> have a toString function - and then why trying to access what should be the
> value and name the same way as with other objects derived at some level from
> Tag blew up instead of working happily.
>
> I'll try converting all of the constructors to your recommendation as
> above, but given that the problem is only happening with this one class, I'm
> not sure that will do much.
>

hopefully that clears it up .. and hopefully you're using version control :D

-nathan


Re: [PHP] String passed to object constructor turning into an instance of that object?

2010-12-16 Thread David Harkness
I've never used the old-style constructors, but perhaps the semantics of
"parent::" changed and you need to instead use "$this->" as in

$this->Tag("option", $name);

That's a total guess. I don't have 5.2 handy to try it out, but both work in
5.3 using a simple example. Can you post the constructor of one of the Tag
subclasses that work? Maybe we can find a common denominator.

David


[PHP] Does ReflectionMethod::setAccessible() do anything?

2010-12-16 Thread David Harkness
According to the manual page for setAccessible() [1] the feature is
available with 5.3.2, and I'm running

5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:49:46)

so I should be good to go. However, even the simplest test to make a
protected or private method accessible fails.

php > class Foo { protected function bar() { echo "foobar\n"; } }
php > $m = new ReflectionMethod('Foo', 'bar');
php > $m->setAccessible(true);
php > $foo = new Foo();
php > $foo->bar();

Fatal error: Call to protected method Foo::bar() from context '' in php
shell code on line 1

I've tried creating the object first, getting to the ReflectionMethod via
ReflectionClass::getMethod(), and making a public method inaccessible, but
all fail. Has anyone used this feature?

The reason I want to do this, in case anyone can suggest a work-around, is
to allow direct unit testing of protected/private methods in classes. What I
do now is have a function that eval()s a dynamic subclass with a __call()
method that proxies to protected methods. This doesn't allow testing private
methods, and it breaks if the class under test has a private/protected
constructor. I can solve the second problem with some further hacking, but
there's nothing I can do about exposing private methods temporarily.
setAccessible() seems perfectly designed to do what I need.

Thanks,
David

[1] http://php.net/manual/en/reflectionmethod.setaccessible.php

--
David Harkness
Senior Software Engineer
High Gear Media


Re: [PHP] String passed to object constructor turning into aninstance of that object?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 3:21 PM, Kris Deugau  wrote:

> Nathan Nobbe wrote:
>
>> Why not test for the type of $name at each point of interest in the
>> SelectBoxOption
>> constructor?  If you're passing a string value to the constructor it
>> almost
>> has to be getting changed by the Tag constructor, right ?
>>
>>  class SelectBoxOption extends Tag {
>>   function SelectBoxOption($name, $value, $selected=false) {
>>
>> var_dump(is_string($name));
>>
>> parent::Tag("option", $name);
>>
>> var_dump(is_string($name));
>>
>
> Ah, that gives...  well, it slightly alters the confusion.
>
> Using var_dump(is_string($name)) gives...  two results?
>
> bool(true)
> bool(false)
>

so you put one check before the call to parent::Tag() & one directly after
right?  That means *somehow* $name is getting set to an instance of
SelectBoxOption in the parent constructor which makes little to no sense..
especially after looking at implementation from your later post.  Main
things are $name is local in the child constructor and there is no pass by
reference on the $name parameter in the parent constructor definition.

if this code runs w/o error on your 5.2 box, then there's something spurious
going on in that old library;

_sTag = $sTag;
$this->_sValue = $sValue;
}
}

class Child extends Tag
{
function Child($name)
{
var_dump($name);
parent::Tag('option', $name);
var_dump($name);
}
}

$oChild = new Child('content');
?>

expected output:

string(7) "content"
string(7) "content"

I'd still recommend moving to the php5 notation throughout the library,
especially if doing that fixes the problem w/ SelectBoxOption.  This
shouldn't break any client code, since clients should all be calling new
Class() and not be explicitly invoking the php4 style constructors.  The
php4 style constructors should only be getting called explicitly from within
the library itself.

-nathan


Re: [PHP] Does ReflectionMethod::setAccessible() do anything?

2010-12-16 Thread Nathan Nobbe
On Thu, Dec 16, 2010 at 6:37 PM, David Harkness
wrote:

> According to the manual page for setAccessible() [1] the feature is
> available with 5.3.2, and I'm running
>
>5.3.2-1ubuntu4.5 with Suhosin-Patch (cli) (built: Sep 17 2010 13:49:46)
>
> so I should be good to go. However, even the simplest test to make a
> protected or private method accessible fails.
>
>php > class Foo { protected function bar() { echo "foobar\n"; } }
>php > $m = new ReflectionMethod('Foo', 'bar');
>php > $m->setAccessible(true);
>php > $foo = new Foo();
>php > $foo->bar();


you just have to invoke the function from the context of the
ReflectionMethod instance

setAccessible(true);
$m->invokeArgs(new Foo(), array());
?>

-nathan


Re: [PHP] Error Querying Database

2010-12-16 Thread Phred White
It seems like there are several questions emerging, but ...

Try echoing your query to the page by putting echo $query in your code before 
you call mysql, then copy it and run it in phpmyadmin. If it runs then you know 
your problem is somewhere else like the connection. This can really help you 
find typos that can cause mysterious results.

If you want to use the same page to process the form (my preference) then put a 
hidden field in your form like:



and wrap the form processing code like so:

if (isset($_POST['phpaction'])) {
//process submitted form data
} else {
//processing for initial form entry
}

When the form is initially loaded it will ignore the first part
There are a 1000 ways to do this, but this is pretty straightforward.

On Dec 15, 2010, at 1:34 PM, Gary wrote:

> 
> "Steve Staples"  wrote in message 
> news:1292440837.5460.8.ca...@webdev01...
>> On Wed, 2010-12-15 at 13:42 -0500, Gary wrote:
>>> I cant seem to get this to connect.  This is to my local testing server,
>>> which is on, so we need not worry that I have posted the UN/PW.
>>> 
>>> This is a duplicate of a script I have used countless times and it 
>>> worked.
>>> The error message is 'Error querying database.'
>>> 
>>> Some one point out the error of my ways?
>>> 
>>> Gary
>>> 
>>> 
>>> " method="post">
>>> 
>>> 
>>> Name of Beer
>>> 
>>> 
>>> 
>>> 
>>> Maker of Beer
>>> 
>>> 
>>> 
>>> 
>>> Type of Beer
>>> 
>>>  Imported
>>>  Domestic
>>>  Craft
>>>  Light
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Sold in
>>>  Singles>> />
>>>  Six Packs 
>>>  Cans
>>>  Bottles 
>>>  Draft 
>>> 
>>> 
>>> Size
>>> 
>>> 
>>> Description>> rows="5">
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> >> $beername = $_POST['beername'];
>>> $manu = $_POST['manu'];
>>> $type = $_POST['type'];
>>> $singles = $_POST['singles'];
>>> $six = $_POST['six'];
>>> $can = $_POST['can'];
>>> $bottles = $_POST['bottles'];
>>> $tap = $_POST['tap'];
>>> $size = $_POST['size'];
>>> $desc = $_POST['desc'];
>>> $ip= $_SERVER['REMOTE_ADDR'];
>>> 
>>> $dbc = mysqli_connect('localhost','root','','rr')or die('Error connecting
>>> with MySQL Database');
>>> 
>>> $query = "INSERT INTO beer (beername, manu, type, singles, six, can,
>>> bottles, tap, size, desc, ip )"." VALUES ('$beername', '$manu', '$type',
>>> '$singles', '$six', '$can', '$bottles', '$tap', '$size', '$desc', 
>>> '$ip' )";
>>> 
>>> $result = mysqli_query($dbc, $query)
>>> or die('Error querying database.');
>>> 
>>> 
>>> mysqli_close($dbc);
>>> 
>>> 
>>> 
>>> -- 
>>> Gary
>> 
>> 
>> Read Ash's reply...   but basically, you're running the query with POST
>> variables, and inserting them on page display as well as on form submit.
>> 
>> can you ensure that you can connect from the command line?
>> 
>> 
>> if you may take some criticism, you should rethink your database design,
>> as well as the page flow/design... you should either post the form to a
>> new page, or if it is back to itself, you should check to see that you
>> have in fact posted it before just blindly inserting into the database
>> (as currently, every time you view the page, you will insert into the
>> database, even if completely empty values).
>> 
> 
> Steve
> 
> Thank you for your reply.
> 
> I did not see a reply from Ashley, but I would love to read it.
> 
> I always welcome criticism, however this form is for the owner of a bar 
> where he will inputing his list of beer that he sells.  The rest of the code 
> that is not there is I will have the list then echo to screen below the 
> form.  This is an internal list only, no customers will be seeing itif 
> that makes any difference to your suggestion.
> 
> On your one point
> 
> <<(as currently, every time you view the page, you will insert into the
> database, even if completely empty values).>>
> 
> Is this always the case when you process a form onto itself?  Or is there a 
> fix?
> 
> I did just create a new page, inserted the script onto it, and got the same 
> error message.
> 
> Again, thank you for your help.
> 
> Gary 
> 
> 
> 
> __ Information from ESET Smart Security, version of virus signature 
> database 5706 (20101215) __
> 
> The message was checked by ESET Smart Security.
> 
> http://www.eset.com
> 
> 
> 
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 



Re: [PHP] PHPInfo disabled due to security

2010-12-16 Thread Paul S

On Thu, 16 Dec 2010 00:13:31 +0700, "Daniel P. Brown"
 wrote:




Well, phpinfo() does, by default, divulge some things that could
be considered security concerns --- particularly in poorly-managed
environments.  Primarily, this is by giving a synopsis of versions and
paths of software, but some versions and configurations will also
broadcast information about the currently logged-in user (PTS/TTY) in
the $_ENV display.  Sure, you can display everything manually that
phpinfo() does automatically, but it's easier for some to vilify
something because they heard it was bad than to actually address the
greater issues.

In cases like this, I'd agree with Al's response; there are plenty
of other web hosts out there.



Well, I was hoping for stronger arguments to get that DONE. I would think
there be something in the PHP license
that would FORBID disabling functionality. After all, 'phpinfo' is
essential, really, to achieving secure
applications, isn't it? My setups are secure, I want to keep it that way.
Shouldn't hosters be required
to provide an alternative phpinfo, say behind the login control panel?

I can't see that anyone could upload a phpinfo command to a properly
configured server and execute it. I have
renamed my 'phpinfo.php' file to something innocuous.

Unfortunately I've found changing hosting companies to often result in a
lot of work for just as
obnoxious tech service as the last.

Thank you both for the feedback. It helps. I've had fetching issues past
couple days with my connection but
think I got that will straightened out soon.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php