php-general Digest 22 Dec 2010 05:26:44 -0000 Issue 7098

Topics (messages 310197 through 310210):

Re: Session problem
        310197 by: Walter Caielli
        310204 by: Ravi Gehlot

Re: Ways to attend usergroups meeting
        310198 by: Daniel Brown

Is there a simple way to enforce a private method in a subclass?
        310199 by: Richard Quadling
        310203 by: David Harkness
        310209 by: Carlos Medina

Re: Problem with Include
        310200 by: Ravi Gehlot
        310205 by: a...@ashleysheridan.co.uk
        310207 by: Ravi Gehlot
        310208 by: Bastien Koert

Re: PHPInfo disabled due to security
        310201 by: Ravi Gehlot

Re: Common session for all subdomains?
        310202 by: Ravi Gehlot

Re: PDO Prepared Statements and stripslashes
        310206 by: Rico Secada

Warning when calling session_start()
        310210 by: webdev.blaettner.com

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've fixed the problem.
I don't know why, but suddenly windows prevents PHP from writing into 
C:\windows\temp directory.
Moving the session and log files to another directory solved the problem.
Until few days ago it worked. I've now to discovered what was changed in 
windows configuration.



""Walter Caielli"" <walter.caie...@ars21.net> ha scritto nel messaggio 
news:bd.40.31041.b7a60...@pb1.pair.com...
> I'm facing the following basic problem:
>
> I have made two simple sample files to explain it:
>
> 1st file:
> <?php
>   session_start();
>    $_SESSION['SS_user'] = "user000";
>   echo $_SESSION['SS_user'];
>   echo SID;
>   echo "<br>".session_id();
>   echo '<br /><a href="home.php">page 1</a>';
> ?>
>
> 2nd file
> <?php
>       session_start();
>       echo "file Home<br>";
>       echo session_name().'+'.session_id();
>       echo $_SESSION['SS_user'];
> ?>
>
> $_SESSION seems to be empty. Nothing is print. Session Name and session ID 
> are the same but it seems that $_SESSION is not shared across the two 
> files. No HTML is made before sessioni_start().
> Why?
> I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from 
> another PC inside a LAN.
>
> Many thanks
> Walter
>
>
> 



--- End Message ---
--- Begin Message ---
Walter,

Session variables may be using cookies which in turn create temp files for
storing such cookies.

Ravi.


On Tue, Dec 21, 2010 at 11:32 AM, Walter Caielli
<walter.caie...@ars21.net>wrote:

> I've fixed the problem.
> I don't know why, but suddenly windows prevents PHP from writing into
> C:\windows\temp directory.
> Moving the session and log files to another directory solved the problem.
> Until few days ago it worked. I've now to discovered what was changed in
> windows configuration.
>
>
>
> ""Walter Caielli"" <walter.caie...@ars21.net> ha scritto nel messaggio
> news:bd.40.31041.b7a60...@pb1.pair.com...
> > I'm facing the following basic problem:
> >
> > I have made two simple sample files to explain it:
> >
> > 1st file:
> > <?php
> >   session_start();
> >    $_SESSION['SS_user'] = "user000";
> >   echo $_SESSION['SS_user'];
> >   echo SID;
> >   echo "<br>".session_id();
> >   echo '<br /><a href="home.php">page 1</a>';
> > ?>
> >
> > 2nd file
> > <?php
> >       session_start();
> >       echo "file Home<br>";
> >       echo session_name().'+'.session_id();
> >       echo $_SESSION['SS_user'];
> > ?>
> >
> > $_SESSION seems to be empty. Nothing is print. Session Name and session
> ID
> > are the same but it seems that $_SESSION is not shared across the two
> > files. No HTML is made before sessioni_start().
> > Why?
> > I'm using PHP 5.3.4 on IIS, windows XP SP3. Tested as localhost or from
> > another PC inside a LAN.
> >
> > Many thanks
> > Walter
> >
> >
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Tue, Dec 21, 2010 at 11:07,  <vikash.i...@gmail.com> wrote:
> Thanks for the link.
> I already been through the given link. But, it is filled with inactive and
> non-responsive groups. I was hoping to get in touch with an active one.

    We don't seem to have any user group events for Mumbai on the
calendar, either.

    If you'd like to start your own group, start by speaking with some
of your fellow PHP users and come up with a date, time, and place to
meet.  Your first meetings don't need any real content --- they can
simply be "mixers" for folks to get together and discuss common
interests.  To get more folks interested, try using social sites like
LinkedIn, Facebook, and Twitter, and don't forget to submit your
meeting details at http://php.net/cal.php.

    After your second or third meeting, you should begin to know how
your group will take shape.  What format will future meetings follow?
Will you have multiple presentations and departments each week, or
will you simply have one topic of discussion and then allow folks to
mingle and trade contact information?  Will you have a two-hour
meeting on the second Tuesday of every month, or a four-hour event
every Saturday?  Figure out what works best for your group and feel
free to reach out via email to other user groups to get some tips on
how they operate.

-- 
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

--- End Message ---
--- Begin Message ---
Hi.

If I have an abstract class of Task and I want all subclasses of Task
to have a private method _runTask, is there a way to enforce this?

Currently an abstract private function in an abstract class isn't allowed.

Fatal error: Abstract function Task::_runTask() cannot be declared
private in D:\PHP\Includes\Task.php on line 91

Now I'm pretty sure there are valid reasons for this, but, for me, the
key part here is the "abstract" modifier.

This should be read first and foremost and simply say that somewhere
in the subclasses, this method must defined. And if it must be defined
as private, then so be it.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

--- End Message ---
--- Begin Message ---
On Tue, Dec 21, 2010 at 8:36 AM, Richard Quadling <rquadl...@gmail.com>wrote:

> If I have an abstract class of Task and I want all subclasses of Task
> to have a private method _runTask, is there a way to enforce this?
>

I cannot think of a reason to force a class to have a specifically-named
*private* method. Since it's private, you cannot call it from outside the
class--not from its superclasses nor any subclasses. Since it cannot be
exposed in the class's API, there's no point in forcing a particular name.

If you are using the Template Method pattern [1], make the method protected.
This allows the superclass that declares the abstract method to call it and
forces its subclasses to implement it given the name you decide.

David

[1] http://c2.com/cgi/wiki?TemplateMethodPattern

--- End Message ---
--- Begin Message ---
Am 21.12.2010 17:36, schrieb Richard Quadling:
Hi.

If I have an abstract class of Task and I want all subclasses of Task
to have a private method _runTask, is there a way to enforce this?

Currently an abstract private function in an abstract class isn't allowed.

Fatal error: Abstract function Task::_runTask() cannot be declared
private in D:\PHP\Includes\Task.php on line 91

Now I'm pretty sure there are valid reasons for this, but, for me, the
key part here is the "abstract" modifier.

This should be read first and foremost and simply say that somewhere
in the subclasses, this method must defined. And if it must be defined
as private, then so be it.

Richard.



Hi Richard,
okay you want to use an abstract class (not instantiable) with a private abstract method. I think this doesnt make sense. And i think, PHP does not allow this because the inheritance constraint will be failed (you can use only in the class itself).

Regards

Carlos

--- End Message ---
--- Begin Message ---
If something is working and you don't know exactly whats under the hood then
you are wasting your time in trying to re-invent your own wheel and waste
your time and resources to modify something that isn't needed to be touched.
Good programmers make good use of their time as well. We need to keep in
check with new technology, learn new trends and also master our weakness. If
we keep changing this or that or moving that or this then oh well...there
goes 1 day worth of work to figure stuff out.

Just my take on this. If you think different, then no problems.

Regards,
Ravi.


On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster <pa...@quillandmouse.com>wrote:

> On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote:
>
> > On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot <r...@ravigehlot.net>
> wrote:
> > > Why mess with something that is already working? If you are trying to
> make
> > > it pretty then you are not solving a problem. You are creating one.
> >
> >
> > Define working. I've had programs 'work', but more experienced would
> > say it's flawed in some respect. Does it perform the immediate task?
> >
> > Now define pretty. Is it aesthetically pleasing to you, or to someone
> > else with less, or maybe more experience.
> >
> > By defining the two above, you then define whether it's a problem. To
> > you, or to them, or to the original designer?
>
> Beware of "more experienced" programmers. I recently talked to an
> ex-boss of mine who had a programmer flake out on him. One of his
> customers threatened to take this flaky code to another company and get
> their opinion about whether it was good code or not. My ex-boss
> explained that, of course, they'd shoot it down. Because that's what
> programmers do-- they complain about other programmers' code. I'd never
> heard that idea expressed aloud. But when I thought about it, I realized
> it was true. Hell, look at the content of this list. ;-}
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
(Apologies for top posting; on my mobile just now.)

Not true. Refactoring code is one of the main tasks of a developer. None of us 
produce perfect code, and some code is less perfect than other code. It's 
instinct to want to fix bad code when we're maintaining it or having to add new 
features to it.

For the same reason car enthusiasts tinker with and tune their cars, good 
developers will do the same with code, be it in the form of consolidating 
common code to include files or other ways. To not do so seems to me to avoid 
ones nature really!

Thanks,
Ash
http://www.ashleysheridan.co.uk

----- Reply message -----
From: "Ravi Gehlot" <r...@ravigehlot.net>
Date: Tue, Dec 21, 2010 18:12
Subject: [PHP] Problem with Include
To: "Paul M Foster" <pa...@quillandmouse.com>
Cc: <php-gene...@lists.php.net>


If something is working and you don't know exactly whats under the hood then
you are wasting your time in trying to re-invent your own wheel and waste
your time and resources to modify something that isn't needed to be touched.
Good programmers make good use of their time as well. We need to keep in
check with new technology, learn new trends and also master our weakness. If
we keep changing this or that or moving that or this then oh well...there
goes 1 day worth of work to figure stuff out.

Just my take on this. If you think different, then no problems.

Regards,
Ravi.


On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster <pa...@quillandmouse.com>wrote:

> On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote:
>
> > On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot <r...@ravigehlot.net>
> wrote:
> > > Why mess with something that is already working? If you are trying to
> make
> > > it pretty then you are not solving a problem. You are creating one.
> >
> >
> > Define working. I've had programs 'work', but more experienced would
> > say it's flawed in some respect. Does it perform the immediate task?
> >
> > Now define pretty. Is it aesthetically pleasing to you, or to someone
> > else with less, or maybe more experience.
> >
> > By defining the two above, you then define whether it's a problem. To
> > you, or to them, or to the original designer?
>
> Beware of "more experienced" programmers. I recently talked to an
> ex-boss of mine who had a programmer flake out on him. One of his
> customers threatened to take this flaky code to another company and get
> their opinion about whether it was good code or not. My ex-boss
> explained that, of course, they'd shoot it down. Because that's what
> programmers do-- they complain about other programmers' code. I'd never
> heard that idea expressed aloud. But when I thought about it, I realized
> it was true. Hell, look at the content of this list. ;-}
>
> Paul
>
> --
> Paul M. Foster
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hello,

Good points. If you are getting paid to do that then fine. There is a
difference between enhancing code and wasting time. I do my best to come up
with the best I can. I always take notes to perform better in upcoming
projects. It is imperative to make good use of time. Unless it is a security
issue, no need to waste time. Again, if you are getting paid for it then
fine. People tune cars for a reason, they want the attention or the thrill.
If you want to tune your code for fun then nobody is against that either :)

Ravi.


On Tue, Dec 21, 2010 at 1:28 PM, a...@ashleysheridan.co.uk <
a...@ashleysheridan.co.uk> wrote:

> (Apologies for top posting; on my mobile just now.)
>
> Not true. Refactoring code is one of the main tasks of a developer. None of
> us produce perfect code, and some code is less perfect than other code. It's
> instinct to want to fix bad code when we're maintaining it or having to add
> new features to it.
>
> For the same reason car enthusiasts tinker with and tune their cars, good
> developers will do the same with code, be it in the form of consolidating
> common code to include files or other ways. To not do so seems to me to
> avoid ones nature really!
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> ----- Reply message -----
> From: "Ravi Gehlot" <r...@ravigehlot.net>
> Date: Tue, Dec 21, 2010 18:12
> Subject: [PHP] Problem with Include
> To: "Paul M Foster" <pa...@quillandmouse.com>
> Cc: <php-gene...@lists.php.net>
>
>
> If something is working and you don't know exactly whats under the hood
> then
> you are wasting your time in trying to re-invent your own wheel and waste
> your time and resources to modify something that isn't needed to be
> touched.
> Good programmers make good use of their time as well. We need to keep in
> check with new technology, learn new trends and also master our weakness.
> If
> we keep changing this or that or moving that or this then oh well...there
> goes 1 day worth of work to figure stuff out.
>
> Just my take on this. If you think different, then no problems.
>
> Regards,
> Ravi.
>
>
> On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster <pa...@quillandmouse.com
> >wrote:
>
> > On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote:
> >
> > > On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot <r...@ravigehlot.net>
> > wrote:
> > > > Why mess with something that is already working? If you are trying to
> > make
> > > > it pretty then you are not solving a problem. You are creating one.
> > >
> > >
> > > Define working. I've had programs 'work', but more experienced would
> > > say it's flawed in some respect. Does it perform the immediate task?
> > >
> > > Now define pretty. Is it aesthetically pleasing to you, or to someone
> > > else with less, or maybe more experience.
> > >
> > > By defining the two above, you then define whether it's a problem. To
> > > you, or to them, or to the original designer?
> >
> > Beware of "more experienced" programmers. I recently talked to an
> > ex-boss of mine who had a programmer flake out on him. One of his
> > customers threatened to take this flaky code to another company and get
> > their opinion about whether it was good code or not. My ex-boss
> > explained that, of course, they'd shoot it down. Because that's what
> > programmers do-- they complain about other programmers' code. I'd never
> > heard that idea expressed aloud. But when I thought about it, I realized
> > it was true. Hell, look at the content of this list. ;-}
> >
> > Paul
> >
> > --
> > Paul M. Foster
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>

--- End Message ---
--- Begin Message ---
On Tue, Dec 21, 2010 at 1:28 PM, a...@ashleysheridan.co.uk
<a...@ashleysheridan.co.uk> wrote:
> (Apologies for top posting; on my mobile just now.)
>
> Not true. Refactoring code is one of the main tasks of a developer. None of 
> us produce perfect code, and some code is less perfect than other code. It's 
> instinct to want to fix bad code when we're maintaining it or having to add 
> new features to it.
>
> For the same reason car enthusiasts tinker with and tune their cars, good 
> developers will do the same with code, be it in the form of consolidating 
> common code to include files or other ways. To not do so seems to me to avoid 
> ones nature really!
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
> ----- Reply message -----
> From: "Ravi Gehlot" <r...@ravigehlot.net>
> Date: Tue, Dec 21, 2010 18:12
> Subject: [PHP] Problem with Include
> To: "Paul M Foster" <pa...@quillandmouse.com>
> Cc: <php-gene...@lists.php.net>
>
>
> If something is working and you don't know exactly whats under the hood then
> you are wasting your time in trying to re-invent your own wheel and waste
> your time and resources to modify something that isn't needed to be touched.
> Good programmers make good use of their time as well. We need to keep in
> check with new technology, learn new trends and also master our weakness. If
> we keep changing this or that or moving that or this then oh well...there
> goes 1 day worth of work to figure stuff out.
>
> Just my take on this. If you think different, then no problems.
>
> Regards,
> Ravi.
>
>
> On Tue, Dec 21, 2010 at 10:23 AM, Paul M Foster 
> <pa...@quillandmouse.com>wrote:
>
>> On Tue, Dec 21, 2010 at 02:35:33AM -0500, David Hutto wrote:
>>
>> > On Tue, Dec 21, 2010 at 2:29 AM, Ravi Gehlot <r...@ravigehlot.net>
>> wrote:
>> > > Why mess with something that is already working? If you are trying to
>> make
>> > > it pretty then you are not solving a problem. You are creating one.
>> >
>> >
>> > Define working. I've had programs 'work', but more experienced would
>> > say it's flawed in some respect. Does it perform the immediate task?
>> >
>> > Now define pretty. Is it aesthetically pleasing to you, or to someone
>> > else with less, or maybe more experience.
>> >
>> > By defining the two above, you then define whether it's a problem. To
>> > you, or to them, or to the original designer?
>>
>> Beware of "more experienced" programmers. I recently talked to an
>> ex-boss of mine who had a programmer flake out on him. One of his
>> customers threatened to take this flaky code to another company and get
>> their opinion about whether it was good code or not. My ex-boss
>> explained that, of course, they'd shoot it down. Because that's what
>> programmers do-- they complain about other programmers' code. I'd never
>> heard that idea expressed aloud. But when I thought about it, I realized
>> it was true. Hell, look at the content of this list. ;-}
>>
>> Paul
>>
>> --
>> Paul M. Foster
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>

+1


-- 

Bastien

Cat, the other other white meat

--- End Message ---
--- Begin Message ---
Hello there,

GoDaddy show 20M for their limit size when they only allow a max of 5.6 MB
of upload. So what I mean is don't try what you see from php_info().


Ravi.


On Tue, Dec 21, 2010 at 9:48 AM, Daniel Brown <danbr...@php.net> wrote:

> On Tue, Dec 21, 2010 at 02:40, Ravi Gehlot <r...@ravigehlot.net> wrote:
> > Hello there,
> >
> > If you have a small to medium size web site then go to GoDaddy. Do not
> > believe all that you see from php_info(). I will give you an example. The
> > memory_limit it gives on shared hosting does not reflect the one intended
> > for your shared account. It shows what was set for overall use. But
> blocking
> > php_info() isn't right (at least I don't think so).
>
>     Please don't top-post in addition to giving incorrect information like
> this.
>
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
>

--- End Message ---
--- Begin Message ---
Daniel,

Good info.

Ravi.


On Tue, Dec 21, 2010 at 10:23 AM, Daniel Brown <danbr...@php.net> wrote:

> On Tue, Dec 21, 2010 at 02:27, Ravi Gehlot <r...@ravigehlot.net> wrote:
> > That's a good question.
> >
> > There should be a setting on php.ini to allow cross session.
>
>     Right.  Because who needs to teach folks about computer security
> when we can just disable it for them anyway?
>
>    Like Jonathan pointed out, it's a matter of adjusting the cookie
> parameters to match wildcard subdomains by preceding the part of the
> domain (usually the SLD, but some ccTLD or FQDN situations can be
> different) with a dot, like so:    .example.com
>
> --
> </Daniel P. Brown>
> Network Infrastructure Manager
> Documentation, Webmaster Teams
> http://www.php.net/
>

--- End Message ---
--- Begin Message ---
On Tue, 21 Dec 2010 10:32:21 -0500
Adam Richardson <simples...@gmail.com> wrote:

> 1. Turn off magic_quotes_gpc if on, as its use has been deprecated.
> 2. Use prepared statements.
> 3. Don't worry about stripping slashes ever again :)

Thank you for a very enlightening answer. I guess I misunderstood
the "PDO automatically quotes.." and the slashes part! :-) 
> Adam
> 
> -- 
> Nephtali:  A simple, flexible, fast, and security-focused PHP
> framework http://nephtaliproject.com
> 

--- End Message ---
--- Begin Message ---

--- End Message ---

Reply via email to