php-general Digest 31 Jul 2008 03:57:57 -0000 Issue 5598

Topics (messages 277475 through 277511):

Re: Why PHP4?
        277475 by: Micah Gersten
        277477 by: Sancar Saran
        277478 by: Jim Lucas
        277484 by: Jason Pruim
        277487 by: Per Jessen
        277498 by: Kevin Waterson
        277504 by: Chris

Re: Creating new site
        277476 by: Micah Gersten
        277479 by: Shawn McKenzie
        277480 by: Hélio Rocha
        277481 by: Robert Cummings
        277482 by: Hélio Rocha
        277490 by: Shawn McKenzie

Windows date("Y/m/d H:i:s") performance
        277483 by: Richard Lynch
        277485 by: Richard Lynch
        277486 by: Andrew Ballard
        277488 by: Andrew Ballard

Still "zend_mm_heap corrupted" error in PHP 5.2.6
        277489 by: santi.usansolo.net

Php Help
        277491 by: birdloww.ctr.jdi.socom.mil
        277492 by: Shawn McKenzie

accessing variables within objects
        277493 by: Marten Lehmann
        277494 by: Jim Lucas
        277495 by: Micah Gersten

Re: Php CLI Parser not working
        277496 by: JJB
        277497 by: Daniel Brown

Re: Web2.0 style tags - where to start?
        277499 by: Kevin Waterson

Not able to load the extensions
        277500 by: John Meyer
        277505 by: Jim Lucas

Back to Basics - Why Use Single Quotes?
        277501 by: Stephen
        277502 by: mike
        277503 by: Daniel Brown

Get Remote-Image
        277506 by: Konrad Priemer
        277511 by: Daniel Brown

Best store for mans
        277507 by: php-general.lists.php.net

Using $_GET for POST
        277508 by: Edward Diener
        277509 by: Micah Gersten
        277510 by: Robert Cummings

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Sometimes speed improvements require removing things.  If you end up
backwards supporting everything you end up with a big monster engine
that is incredibly slow.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Hélio Rocha wrote:
> Brainfuck rox! LOL :)
>
> Sure you must see the changelog and other things but take a look:
> I can do more and better things with the next generation of the language in
> which i wrote my app, but i don't think that it's fair that my app doens't
> compile (if it was a compiled language) or stops executing just because i
> get an upgrade.
>
> On Wed, Jul 30, 2008 at 10:56 AM, Richard Heyes <[EMAIL PROTECTED]>wrote:
>
>   
>>> Sorry to disagree,
>>>       
>> That's nothing to apologise for.
>>
>>     
>>> But I think that with PHP4 a lot of people start thinking that they could
>>>       
>> be
>>     
>>> programmers (maybe they can, developers it's another story). When php5
>>>       
>> came
>>     
>>> they didn't know how do deal with the deprecated methods and worst, some
>>> hosters didn't know how to virtualize a f1ck1n' server with Apache+PHP5.
>>>       
>> A
>>     
>>> lot of mistakes were made when php5 came out but how can a language grow
>>>       
>> up
>>     
>>> when they DEPRECATE the syntax? we're not talking about removing the last
>>>       
>> That's not the problem of the PHP developers. Learning is not a case
>> of spend a few years doing it and you're set - it's a life long thing.
>>
>>     
>>> Maybe I'm in a "GET LOST PHP" phase but I think that someone is killing
>>>       
>> it,
>>     
>>> and the ones who are stuck in 4 are not helping.
>>>       
>> There are alternatives - have you heard of Brainfuck?
>>
>>     
>>> When U write code, U must not be worried 'bout the next upgrade of your
>>> server!
>>>       
>> Of course you should. Writing code with every eventuality in mind is
>> simply ludicrous. And you really should expect things to change when
>> major versions are changed - that's why release notes exist.
>>
>> --
>> Richard Heyes
>> http://www.phpguru.org
>>
>>     
>
>   

--- End Message ---
--- Begin Message ---
Because,

People believes

Do not fix until broke

Motto.


Testing new online application may painfull.

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
Richard Heyes wrote:

I agree but not everyone think in the sameway. I have seen several
big websites that got hit because they haven't used super globals in
the code and their hosting provided would just change the PHP.ini
setting and nothing would work.
Well if it's a "big" website then why use a hoster that changes the
php.ini without much, if any, thought?


The technical abilities and awareness is often inversely proportional to
the size of the hoster.

/Per Jessen, Zürich



I am the tech support department, not only web hosting but Phones, DSL, T1, Email, Toll Free, etc...

The key thing in tech support, is to get to the problem and fix it. Don't let the conversation get away from the reason they called. As long as you can fix the problem, assuming their is a problem, the customer will be happy. But all the while not sounding harsh or impatient to the customer.

But, on the flip side, you don't want to be just a knowledge base that people could login to on your website. Isn't that they reason you have live support?

Anyways...

--
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 Jul 30, 2008, at 10:50 AM, Micah Gersten wrote:

Sometimes speed improvements require removing things.  If you end up
backwards supporting everything you end up with a big monster engine
that is incredibly slow.


Just ask Microsoft about that ;)


--

Jason Pruim
Raoset Inc.
Technology Manager
MQC Specialist
11287 James St
Holland, MI 49424
www.raoset.com
[EMAIL PROTECTED]





--- End Message ---
--- Begin Message ---
Jason Pruim wrote:

> 
> On Jul 30, 2008, at 10:50 AM, Micah Gersten wrote:
> 
>> Sometimes speed improvements require removing things.  If you end up
>> backwards supporting everything you end up with a big monster engine
>> that is incredibly slow.
> 
> 
> Just ask Microsoft about that ;)

Better ask IBM instead - they've done it for much longer and with much
better results. 


/Per Jessen, Zürich


--- End Message ---
--- Begin Message ---
This one time, at band camp, "Richard Heyes" <[EMAIL PROTECTED]> wrote:

> I'm interested - why are people still using PHP4? It's been over 4
> years (I think) - plenty of time to upgrade to five.

I asked that question and was called a troll...

Kevin

--- End Message ---
--- Begin Message ---
Per Jessen wrote:
> Lester Caine wrote:
> 
>> Some ISP's are still only supporting rather ancient versions of PHP4.
>> They should simply be warned of the security risks. Some ISP's have a
>> PHP5 offering, but again an older version simply because it causes
>> less problems when converting from PHP4. 
> 
> The problem for an ISP is - with thousands of customers, he has no way
> of knowing who has used what PHP extension or feature.  Without
> virtually guaranteed backwards compatibility, a mass upgrade of 4 to 5
> could be a major headache.  
> Besides, are the security risks sufficiently severe for the ISP to
> warrant the upgrade effort+headache?

Definitely. I've been the server-admin behind this sort of stuff
(actually php3 -> php4 :P) and it's very hard to do even on your own
servers. Clients get other developers to write their software so you
have no idea what it does etc, you can't support it, you certainly don't
want to break it - so as much as possible you leave the server alone (of
course you upgrade for security issues, that's a given).

In time you get a new server and slowly migrate people to that, kill off
the old server and rinse-repeat.

-- 
Postgresql & php tutorials
http://www.designmagick.com/

--- End Message ---
--- Begin Message ---
Depending on the size of the site, you might want to consider a PHP
framework to start with.  There's usually no point in reinventing the
wheel.  Someone mentioned CakePHP which utilizes MVC.  I'm looking into
porting my stuff to the Zend Framework which makes MVC optional, but has
a lot of functionality make available.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Raido wrote:
> Hi,
>
> There are many sites explaining how to build new site etc but I'd like
> to hear what You suggest. (about how to plan whole thing and how to
> write separate parts which can be put together later)
>
> I have build many small sites for myself(site to organise class
> assembly which is like yearly convention..it has user administration
> etc) but they all are anything else than OOP. But now, I need to help
> with creating one bigger site which should be OOP. That site should
> include user management(each user has it's own profile), each user can
> post job and other adds in different categories. (there will be many
> categories for example 'work,cars,training,apartments'.)
> And users profile should show ads posted by himself.
> Logic itself is simple:
> 1) unregistered user:
>     a) I go to site, I see categories (work offers, apartment offers,
> training offers, etc)
>     b) I click on category I'm interested in
>     c) I see ad that I'm interested in
>     d) I click on it
>     c) I see detailed information about it(which company posted it etc)
>     d) at bottom page I see form where I can contact with ad author
> 2) registered user
>     a) I go to site
>     b) I log in, my profile page opens
>     c) there I can see ads posted by me..also I can see how many times
> ad is viewed etc
>     d) i click on link 'Post new ad'
>     e) there i choose category and probably Ajax helps to load
> specific fields(for example if I choose 'Cars' as category, then
> fields like      'year,transmission,color, etc' will appear.
>
> That is short summary what that site should do. It seems quite big for
> me so I'd be happy to hear any guidelines from people who have built
> big sites.
>
> Creating forms, posting data, user login etc, these things are not
> problem... problem is: how to build the whole thing aimed to OOP and
> use with Smarty to keep things organized.
>
> I'm not sure but I have idea about what things I should do first:
>
> 1) think and write down any function that needs to be done(for example
> different validations, functions for showing/posting form etc)
> 2) plan and create database?
> 3) create database class which handles database connection
> But what next? Or am I starting all wrong?
>
> Big thanks in advance,
>
>
> Raido
>
>
>

--- End Message ---
--- Begin Message ---
Micah Gersten wrote:
Depending on the size of the site, you might want to consider a PHP
framework to start with.  There's usually no point in reinventing the
wheel.  Someone mentioned CakePHP which utilizes MVC.  I'm looking into
porting my stuff to the Zend Framework which makes MVC optional, but has
a lot of functionality make available.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com


I too like CakePHP. I have coded in PHP for quite a while and understand OOP and OOP in PHP, however I don't really have any experience building sites or apps from scratch using OOP/MVC.

Cake or a framework makes it much quicker and easier. For those that need total freedom to do things the way they want but need some pre-built functionality to make it quicker, Zend seems to be the choice. I consider Zend to be more of a class library like PEAR only more consistant. For me, I had no habits/best practices or preferred way when I started with OOP/MVC so Cake was great. It has a certain structure and uses certain conventions and code generation which makes it very quick and easy. The main drawback is the docs.

-Shawn



Raido wrote:
Hi,

There are many sites explaining how to build new site etc but I'd like
to hear what You suggest. (about how to plan whole thing and how to
write separate parts which can be put together later)

I have build many small sites for myself(site to organise class
assembly which is like yearly convention..it has user administration
etc) but they all are anything else than OOP. But now, I need to help
with creating one bigger site which should be OOP. That site should
include user management(each user has it's own profile), each user can
post job and other adds in different categories. (there will be many
categories for example 'work,cars,training,apartments'.)
And users profile should show ads posted by himself.
Logic itself is simple:
1) unregistered user:
    a) I go to site, I see categories (work offers, apartment offers,
training offers, etc)
    b) I click on category I'm interested in
    c) I see ad that I'm interested in
    d) I click on it
    c) I see detailed information about it(which company posted it etc)
    d) at bottom page I see form where I can contact with ad author
2) registered user
    a) I go to site
    b) I log in, my profile page opens
    c) there I can see ads posted by me..also I can see how many times
ad is viewed etc
    d) i click on link 'Post new ad'
    e) there i choose category and probably Ajax helps to load
specific fields(for example if I choose 'Cars' as category, then
fields like      'year,transmission,color, etc' will appear.

That is short summary what that site should do. It seems quite big for
me so I'd be happy to hear any guidelines from people who have built
big sites.

Creating forms, posting data, user login etc, these things are not
problem... problem is: how to build the whole thing aimed to OOP and
use with Smarty to keep things organized.

I'm not sure but I have idea about what things I should do first:

1) think and write down any function that needs to be done(for example
different validations, functions for showing/posting form etc)
2) plan and create database?
3) create database class which handles database connection
But what next? Or am I starting all wrong?

Big thanks in advance,


Raido




--- End Message ---
--- Begin Message ---
U may want to see Ruby On Rails www.rubyonrails.org . It's also a framework
but for Ruby. In my opinion it's stronger than cake and there are some IDE's
that do support and debug it.

Cumps,
Hélio Rocha

On Wed, Jul 30, 2008 at 4:54 PM, Shawn McKenzie <[EMAIL PROTECTED]>wrote:

> Micah Gersten wrote:
>
>> Depending on the size of the site, you might want to consider a PHP
>> framework to start with.  There's usually no point in reinventing the
>> wheel.  Someone mentioned CakePHP which utilizes MVC.  I'm looking into
>> porting my stuff to the Zend Framework which makes MVC optional, but has
>> a lot of functionality make available.
>>
>> Thank you,
>> Micah Gersten
>> onShore Networks
>> Internal Developer
>> http://www.onshore.com
>>
>>
> I too like CakePHP.  I have coded in PHP for quite a while and understand
> OOP and OOP in PHP, however I don't really have any experience building
> sites or apps from scratch using OOP/MVC.
>
> Cake or a framework makes it much quicker and easier. For those that need
> total freedom to do things the way they want but need some pre-built
> functionality to make it quicker, Zend seems to be the choice.  I consider
> Zend to be more of a class library like PEAR only more consistant.  For me,
> I had no habits/best practices or preferred way when I started with OOP/MVC
> so Cake was great.  It has a certain structure and uses certain conventions
> and code generation which makes it very quick and easy.  The main drawback
> is the docs.
>
> -Shawn
>
>
>
>>
>> Raido wrote:
>>
>>> Hi,
>>>
>>> There are many sites explaining how to build new site etc but I'd like
>>> to hear what You suggest. (about how to plan whole thing and how to
>>> write separate parts which can be put together later)
>>>
>>> I have build many small sites for myself(site to organise class
>>> assembly which is like yearly convention..it has user administration
>>> etc) but they all are anything else than OOP. But now, I need to help
>>> with creating one bigger site which should be OOP. That site should
>>> include user management(each user has it's own profile), each user can
>>> post job and other adds in different categories. (there will be many
>>> categories for example 'work,cars,training,apartments'.)
>>> And users profile should show ads posted by himself.
>>> Logic itself is simple:
>>> 1) unregistered user:
>>>    a) I go to site, I see categories (work offers, apartment offers,
>>> training offers, etc)
>>>    b) I click on category I'm interested in
>>>    c) I see ad that I'm interested in
>>>    d) I click on it
>>>    c) I see detailed information about it(which company posted it etc)
>>>    d) at bottom page I see form where I can contact with ad author
>>> 2) registered user
>>>    a) I go to site
>>>    b) I log in, my profile page opens
>>>    c) there I can see ads posted by me..also I can see how many times
>>> ad is viewed etc
>>>    d) i click on link 'Post new ad'
>>>    e) there i choose category and probably Ajax helps to load
>>> specific fields(for example if I choose 'Cars' as category, then
>>> fields like      'year,transmission,color, etc' will appear.
>>>
>>> That is short summary what that site should do. It seems quite big for
>>> me so I'd be happy to hear any guidelines from people who have built
>>> big sites.
>>>
>>> Creating forms, posting data, user login etc, these things are not
>>> problem... problem is: how to build the whole thing aimed to OOP and
>>> use with Smarty to keep things organized.
>>>
>>> I'm not sure but I have idea about what things I should do first:
>>>
>>> 1) think and write down any function that needs to be done(for example
>>> different validations, functions for showing/posting form etc)
>>> 2) plan and create database?
>>> 3) create database class which handles database connection
>>> But what next? Or am I starting all wrong?
>>>
>>> Big thanks in advance,
>>>
>>>
>>> Raido
>>>
>>>
>>>
>>>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
On Wed, 2008-07-30 at 17:03 +0100, Hélio Rocha wrote:
> U may want to see Ruby On Rails www.rubyonrails.org . It's also a framework
> but for Ruby. In my opinion it's stronger than cake and there are some IDE's
> that do support and debug it.

Dear Hélio,

This is a PHP list. People usually come here for PHP related answers.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
Sorry Robert and all other users.

On Wed, Jul 30, 2008 at 5:07 PM, Robert Cummings <[EMAIL PROTECTED]>wrote:

> On Wed, 2008-07-30 at 17:03 +0100, Hélio Rocha wrote:
> > U may want to see Ruby On Rails www.rubyonrails.org . It's also a
> framework
> > but for Ruby. In my opinion it's stronger than cake and there are some
> IDE's
> > that do support and debug it.
>
> Dear Hélio,
>
> This is a PHP list. People usually come here for PHP related answers.
>
> Cheers,
> Rob.
> --
> http://www.interjinn.com
> Application and Templating Framework for PHP
>
>

--- End Message ---
--- Begin Message ---
Hélio Rocha wrote:
U may want to see Ruby On Rails www.rubyonrails.org . It's also a framework
but for Ruby. In my opinion it's stronger than cake and there are some IDE's
that do support and debug it.

Cumps,
Hélio Rocha


There's also .NET http://www.microsoft.com. It's also a framework but for VB/C# I think. In my opinion it's stronger than cake and there are some IDE's that do support and debug it, as well as a lot of documentation.

-Shawn

--- End Message ---
--- Begin Message ---
I was profiling some code on my local dev box, and in Windows, the
biggest time sink for the home page is...

a call to date("Y/m/d H:i:s")?!
917 ms???

Here is what I get in a cygwin shell:
php -r '$c = 100; $s = microtime(true); for($i = 0; $i < $c; $i++){ $d
= date("Y/m/d H:i:s"); } echo (microtime(true) - $s)/$c, "\n"; '
1.0072922205925

Same results from a DOS prompt, though I have to actually create a
file as -r didn't seem to work...

Feel free to change $c to 10 to get a faster answer...

Can 'date' really take almost a full second to execute in Doze?...

That seems pretty whack...

-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



--- End Message ---
--- Begin Message ---
I suppose to be complete, I should point out that in Linux a call to
date finishes in 1.2271404266357E-5 seconds on average.

For those unfamiliar with scientific notation, that would be:
0.000012271404266357 seconds, or rougly 1/10,000th of the time Doze
takes.

-- 
Some people ask for gifts here.
I just want you to buy an Indie CD for yourself:
http://cdbaby.com/search/from/lynch



--- End Message ---
--- Begin Message ---
On Wed, Jul 30, 2008 at 12:11 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> I was profiling some code on my local dev box, and in Windows, the
> biggest time sink for the home page is...
>
> a call to date("Y/m/d H:i:s")?!
> 917 ms???
>
> Here is what I get in a cygwin shell:
> php -r '$c = 100; $s = microtime(true); for($i = 0; $i < $c; $i++){ $d
> = date("Y/m/d H:i:s"); } echo (microtime(true) - $s)/$c, "\n"; '
> 1.0072922205925
>
> Same results from a DOS prompt, though I have to actually create a
> file as -r didn't seem to work...
>
> Feel free to change $c to 10 to get a faster answer...
>
> Can 'date' really take almost a full second to execute in Doze?...
>
> That seems pretty whack...
>

I just ran your test code inside Zend Studio under Windows XP and it
printed 0.00044636011123657

Andrew

--- End Message ---
--- Begin Message ---
On Wed, Jul 30, 2008 at 12:19 PM, Richard Lynch <[EMAIL PROTECTED]> wrote:
> I suppose to be complete, I should point out that in Linux a call to
> date finishes in 1.2271404266357E-5 seconds on average.
>
> For those unfamiliar with scientific notation, that would be:
> 0.000012271404266357 seconds, or rougly 1/10,000th of the time Doze
> takes.
>

Interesting. Just for comparison, I ran it directly with the binaries
(disabling the debugger) for PHP 4.4.4 and 5.2.0 on my machine.

4.4.4 - in the order of 4.5E-6 - 5.0E-6

5.2.0 - right around 1.0E-4

Andrew

--- End Message ---
--- Begin Message ---
Dear Srs,

We are having some "zend_mm_heap corrupted" errors followed by a
"Segmentation fault (11)" in our Apache2 + PHP 5.2.6 servers. There are few
information about this "bug" in internet:

 * #40479 -> http://bugs.php.net/bug.php?id=40479
 * #43295 -> http://bugs.php.net/bug.php?id=43295

I have applied all proposed patches, tested with PHP 5.2.5 and 5.2.6.. and
I still have the error :-/

Anyone has more info about this, or how to solve/prevent?

I'm also looking for a method to get more info about this crash: what
virtualhost + PHP scripts generate it and the timestamp, for example. What
can I do to get more info? Searching in the source code, I see that this
message only is printed by the zend_mm_panic() function in
"Zend/zend_alloc.c" file, anyideas to hack this function to get more info?

static void zend_mm_panic(const char *message)
{
        fprintf(stderr, "%s\n", message);
#if ZEND_DEBUG && defined(HAVE_KILL) && defined(HAVE_GETPID)
        kill(getpid(), SIGSEGV);
#endif
        exit(1);
}

Is there any macro o similar to get the URL, virtualhost or PHP
script/path? Thanks!!

Regards,

--Santi Saez






--- End Message ---
--- Begin Message ---
I cannot get Php to run on Solaris 10...
Here is the error I am getting....
____________________________________________________________
Trying to run php outside of apache

ld.so.1: php: fatal: libldap-2.3.so.0: open failed: No such file or
directory  


With Apache....Apache will not load when trying to load the php modules

Syntax error on line 110 of /usr/local/apache2/conf/httpd.conf: 
Cannot load /usr/local/apache2/modules/libphp5.so into server: ld.so.1: 
httpd: fatal: libldap-2.3.so.0: open failed: No such file or directory




Environmental Setting 
DISPLAY= 
HOME=/ 
HZ=100 
LOGNAME=wayne 
MAIL=/var/mail/wayne 
PATH=/usr/sbin:/usr/bin 
PS1=#  
SHELL=/bin/sh 
TERM=xterm 
TZ=US/Eastern
_______________________________________________
I have gone to the lib directory and can find libldap-2.4.so.2 ..
Can you point me in the right direction???

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
I cannot get Php to run on Solaris 10...
Here is the error I am getting....
____________________________________________________________
Trying to run php outside of apache

ld.so.1: php: fatal: libldap-2.3.so.0: open failed: No such file or
directory

With Apache....Apache will not load when trying to load the php modules

Syntax error on line 110 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: ld.so.1: httpd: fatal: libldap-2.3.so.0: open failed: No such file or directory




Environmental Setting DISPLAY= HOME=/ HZ=100 LOGNAME=wayne MAIL=/var/mail/wayne PATH=/usr/sbin:/usr/bin PS1=# SHELL=/bin/sh TERM=xterm TZ=US/Eastern
_______________________________________________
I have gone to the lib directory and can find libldap-2.4.so.2 ..
Can you point me in the right direction???

Well, it's not looking for libldap-2.4.so.2, it wants libldap-2.3.so.0.

So first try creating a link of libldap-2.3.so.0 to libldap-2.4.so.2. Been a while for me on Solaris.

-Shawn

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

I'm using some php-classes which worked fine with php-5.0.4. Now I tried to upgrade to php-5.2.6, but the classes give a lot of errors. If I set

error_reporting(E_ALL);

I see messages like

Notice: Undefined property: FastTemplate::$main in /whereever/inc.template.php on line 293

Notice: Undefined property: current_session::$cust_id in /whereever/inc.init.php on line 117

In inc.template.php there are a lot of calls like $this->$key. In inc.init.php there are calls like $session->cust_id.

What has changed in php-5.2.x so that these calls don't work any more? What is the new, required form to use objects in a similar manner (unfortunately I have no ressources to code these classes from scratch)? Thanks.

Kind regards
Marten

--- End Message ---
--- Begin Message ---
Marten Lehmann wrote:
Hello,

I'm using some php-classes which worked fine with php-5.0.4. Now I tried to upgrade to php-5.2.6, but the classes give a lot of errors. If I set

error_reporting(E_ALL);

I see messages like

Notice: Undefined property: FastTemplate::$main in /whereever/inc.template.php on line 293

Notice: Undefined property: current_session::$cust_id in /whereever/inc.init.php on line 117

In inc.template.php there are a lot of calls like $this->$key. In inc.init.php there are calls like $session->cust_id.

to fix these errors, you would need to modify the code so it does something like this.

where it calls $this->$key you need to check and make sure that $key exists before you trying call for it.

So something like this would work.

if ( isset( $this->$key ) ) {
        $this->$key;
} else {
        $this->$key = null;
}

You didn't show any context in which you are using the above code. So I don't know what will actually work in your situation. Show a little more code that includes the method in which $this->$key is called.

You will want to look at using the Overloading feature of PHP5. Check out this page for overloading examples

http://us2.php.net/manual/en/language.oop5.overloading.php

Take note of the __get() and __set() methods. The __get method checks to see if the key exists before it tries working with it.


What has changed in php-5.2.x so that these calls don't work any more? What is the new, required form to use objects in a similar manner (unfortunately I have no ressources to code these classes from scratch)? Thanks.

Kind regards
Marten


--
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 ---
You might want to check the scope of the properties.  If you want to
access them outside of the class, make sure they are declared public.

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Marten Lehmann wrote:
> Hello,
>
> I'm using some php-classes which worked fine with php-5.0.4. Now I
> tried to upgrade to php-5.2.6, but the classes give a lot of errors.
> If I set
>
> error_reporting(E_ALL);
>
> I see messages like
>
> Notice: Undefined property: FastTemplate::$main in
> /whereever/inc.template.php on line 293
>
> Notice: Undefined property: current_session::$cust_id in
> /whereever/inc.init.php on line 117
>
> In inc.template.php there are a lot of calls like $this->$key. In
> inc.init.php there are calls like $session->cust_id.
>
> What has changed in php-5.2.x so that these calls don't work any more?
> What is the new, required form to use objects in a similar manner
> (unfortunately I have no ressources to code these classes from
> scratch)? Thanks.
>
> Kind regards
> Marten
>

--- End Message ---
--- Begin Message ---
Daniel Brown wrote:
On Tue, Jul 29, 2008 at 2:19 PM, JJB <[EMAIL PROTECTED]> wrote:
We recently rebuilt a webserver and upgraded it to opensuse 10.3.
Now, when our webdev people run command line php scripts all of the
included files are being output to the terminal instead of parsed.

    How are the scripts being run from the CLI?  As shell scripts with
this as the following line:

#!/path/to/php

    -or-

#!/bin/env php

    .... or by using the command 'php script.php' from the command line?


    What do you see when, from the command line, you issue the command
'php -v' ?


Hi Daniel,

We are running like:
php mailscript.php

The version:

php-v

PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Dec 12 2007 03:51:56)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies



--- End Message ---
--- Begin Message ---
On Wed, Jul 30, 2008 at 4:53 PM, JJB <[EMAIL PROTECTED]> wrote:
>
> Hi Daniel,
>
> We are running like:
> php mailscript.php
>
> The version:
>
> php-v
>
> PHP 5.2.5 with Suhosin-Patch 0.9.6.2 (cli) (built: Dec 12 2007 03:51:56)

    Did you check what Jim suggested, as well, about short_open_tags?
If your scripts use PHP tags like this:

    <?

    .... instead of like this:

    <?php

    .... that's most likely the issue.  You can either modify all of
the PHP scripts to use the latter version of tag opening, or you can
modify your php.ini file to set short_open_tags to On (and then
restart Apache for the changes to take effect).

-- 
</Daniel P. Brown>
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
This one time, at band camp, "Paul Jinks" <[EMAIL PROTECTED]> wrote:

> Does anyone know of any good resources on building a tagging system? The
> video for now will be held on a normal LAMP machine as will everything
> else.

Tagging...
http://phpro.org/tutorials/Tagging-With-PHP-And-MySQL.html

Kevin

--- End Message ---
--- Begin Message ---
Apache 2.2
PHP 5.2.6 (as a module)
Windows

Relevant parts of php.ini
; Directory in which the loadable extensions (modules) reside.
extension_dir = I:\php\ext

extension=I:\php\ext\php_mssql.dll
extension=I:\php\ext\php_mysql.dll

Note: I did try it with just the name ("php_mysql.dll") but it doesn't seem to work either way

And httpd.conf:

LoadModule php5_module I:\php\php5apache2_2.dll
AddType application/x-httpd-php .php
PHPIniDir C:\WINDOWS

--- End Message ---
--- Begin Message ---
John Meyer wrote:
Apache 2.2
PHP 5.2.6 (as a module)
Windows

Relevant parts of php.ini
; Directory in which the loadable extensions (modules) reside.
extension_dir = I:\php\ext

extension=I:\php\ext\php_mssql.dll
extension=I:\php\ext\php_mysql.dll

Note: I did try it with just the name ("php_mysql.dll") but it doesn't seem to work either way

And httpd.conf:

LoadModule php5_module I:\php\php5apache2_2.dll
AddType application/x-httpd-php .php
PHPIniDir C:\WINDOWS


What type of errors, if any, do you get when you try and start Apache w/php? Check your Apache and PHP error_log files. Let us know what you find.
--- End Message ---
--- Begin Message ---
I have traditionally used double quotes going back to my PASCAL days.

I see many PHP examples using single quotes, and I began to adopt that convention.

Even updating existing code.

And I broke some stuff that was doing variable expansion. So I am back to using double quotes.

But I wonder, is there any reason to use single quotes?

Stephen

--- End Message ---
--- Begin Message ---
On 7/30/08, Stephen <[EMAIL PROTECTED]> wrote:

> But I wonder, is there any reason to use single quotes?

extremely minor performance gains, afaik.

probably moreso when doing $foo["bar"] and $foo['bar']

but i believe it's negligible $foo = 'bar' and $foo = "bar"

sara golemon did some performance tests with actual opcode results here:
http://blog.libssh2.org/index.php?/archives/28-How-long-is-a-piece-of-string.html

--- End Message ---
--- Begin Message ---
On Wed, Jul 30, 2008 at 6:51 PM, Stephen <[EMAIL PROTECTED]> wrote:
> I have traditionally used double quotes going back to my PASCAL days.
>
> I see many PHP examples using single quotes, and I began to adopt that
> convention.
>
> Even updating existing code.
>
> And I broke some stuff that was doing variable expansion. So I am back to
> using double quotes.
>
> But I wonder, is there any reason to use single quotes?

    Single quotes means literal, whereas double quotes means translated.

    For example:

<?php

// This returns exactly the same data:
$foo_a = "bar";
$foo_b = 'bar';

echo $foo_a; // bar
echo $foo_b; // bar


// This returns different data:
$foo = "bar"; // Single quotes can be used here just the same.

echo "The answer is $foo"; // The answer is bar
echo 'The answer is $foo'; // The answer is $foo


/* And if you want to use special
    characters like newlines, you
    MUST use double quotes. */

echo "This echoes a newline.\n"; // This echoes a newline. [newline]
echo 'This echoes a literal \n'; // This echoes a literal \n

?>

    Basically, double quotes evaluate certain things and return the
evaluation, while single quotes return EXACTLY what's typed between
them.

-- 
</Daniel P. Brown>
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
Moin,

 

kann mir mal wer auf die Sprünge helfen, ich bekomme es gerade nicht
geregelt ein Image "on-the-fly" von einem Remote-Host per fsockopen auf
meinen Server zu ziehen.

Irgendwo hab ich da voll die Blockade ;)

 

Mein "nichtfunktionierender" Versuch:

 

...

...

$out = "GET ".<URL_REMOTE_IMAGE>." HTTP/1.0\r\nHost:
".$this->host."\r\nUser-Agent: GetWiki for WordPress\r\n\r\n";

$fp = fsockopen($this->host, $this->port, $errno, $errstr, 30);

$File = fopen(<PFAD_ZUM_ASPEICHERN>,"wb"); 

fwrite( $File, $out );

fclose($File);

fclose($fp);

...

...

 

THX und Grüße

 

Conny

 

 


--- End Message ---
--- Begin Message ---
On Wed, Jul 30, 2008 at 9:50 PM, Konrad Priemer <[EMAIL PROTECTED]> wrote:
>
> kann mir mal wer auf die Sprünge helfen, ich bekomme es gerade nicht
> geregelt ein Image "on-the-fly" von einem Remote-Host per fsockopen auf
> meinen Server zu ziehen.
>
> Irgendwo hab ich da voll die Blockade ;)


    Die copy() Funktion kann mit URL arbeiten.

        http://php.net/copy

-- 
</Daniel P. Brown>
Better prices on dedicated servers:
Intel 2.4GHz/60GB/512MB/2TB $49.99/mo.
Intel 3.06GHz/80GB/1GB/2TB $59.99/mo.
Dedicated servers, VPS, and hosting from $2.50/mo.

--- End Message ---
--- Begin Message ---
Dont leave your nights dissatisfied

http://uimeds.com/


--- End Message ---
--- Begin Message --- In handling an HTTP POST request I came across some PHP code, which I need to modify for my own purposes, which has code like this:

if ( ! (isset($_GET['xxxxx']) && $_GET['xxxxx'] == 20) )
   {    
   // Do something by returning an error
   }

Can this ever be correct when the form looks like:

        <form ENCTYPE="multipart/form-data" ACTION="" METHOD="POST">
        <input NAME="SomeFile" TYPE="file">
        <input VALUE="submit" TYPE="submit"></form>

?

Is the $_GET possibly being used to check for an 'xxxxx' parameter being passed in the query part of the URL ?

I am fairly new to PHP so I am trying to understand how $_GET differs from $_POST. Thanks !
--- End Message ---
--- Begin Message ---
This page can help you understand them better:
http://us2.php.net/manual/en/language.variables.superglobals.php

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



Edward Diener wrote:
> In handling an HTTP POST request I came across some PHP code, which I
> need to modify for my own purposes, which has code like this:
>
> if ( ! (isset($_GET['xxxxx']) && $_GET['xxxxx'] == 20) )
>    {   
>    // Do something by returning an error
>    }
>
> Can this ever be correct when the form looks like:
>
>     <form ENCTYPE="multipart/form-data" ACTION="" METHOD="POST">
>     <input NAME="SomeFile" TYPE="file">
>     <input VALUE="submit" TYPE="submit"></form>
>
> ?
>
> Is the $_GET possibly being used to check for an 'xxxxx' parameter
> being passed in the query part of the URL ?
>
> I am fairly new to PHP so I am trying to understand how $_GET differs
> from $_POST. Thanks !
>

--- End Message ---
--- Begin Message ---
On Wed, 2008-07-30 at 22:18 -0400, Edward Diener wrote:
> In handling an HTTP POST request I came across some PHP code, which I 
> need to modify for my own purposes, which has code like this:
> 
> if ( ! (isset($_GET['xxxxx']) && $_GET['xxxxx'] == 20) )
>     { 
>     // Do something by returning an error
>     }
> 
> Can this ever be correct when the form looks like:
> 
>       <form ENCTYPE="multipart/form-data" ACTION="" METHOD="POST">
>       <input NAME="SomeFile" TYPE="file">
>       <input VALUE="submit" TYPE="submit"></form>
> 
> ?
> 
> Is the $_GET possibly being used to check for an 'xxxxx' parameter being 
> passed in the query part of the URL ?
> 
> I am fairly new to PHP so I am trying to understand how $_GET differs 
> from $_POST. Thanks !

Yes this can be correct. Since the above action is set to blank, the
form will submit to the same page as that on which is is presented. As
such, if any GET parameters were set in the URL, they will be
re-presented upon submission along with any POSTed data.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---

Reply via email to