php-general Digest 10 May 2010 10:39:40 -0000 Issue 6736

Topics (messages 305026 through 305032):

__call and recursion
        305026 by: Daniel Kolbo
        305027 by: Peter Lind
        305028 by: Nathan Nobbe
        305029 by: Peter Lind

Re: PHP Encoder like IonCube
        305030 by: donald sullivan
        305031 by: shiplu

PHP Application Structre
        305032 by: Alex Major

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 ---
Hello,

I've defined a __call() method inside a class.  Within the __call()
method (after testing that the method exists and is callable I am using:

call_user_func_array(array($this,$method), $args);

However, this seems to be an infinite loop (and is crashing my test
apache server).  How, could I still use the __call() method and avoid an
infinite loop of calling?

Thanks,
dK
`

--- End Message ---
--- Begin Message ---
On 9 May 2010 23:21, Daniel Kolbo <kolb0...@umn.edu> wrote:
> Hello,
>
> I've defined a __call() method inside a class.  Within the __call()
> method (after testing that the method exists and is callable I am using:
>
> call_user_func_array(array($this,$method), $args);
>
> However, this seems to be an infinite loop (and is crashing my test
> apache server).  How, could I still use the __call() method and avoid an
> infinite loop of calling?

Assuming that your __call() method was reached because no $method was
defined, using call_user_func_array() to call $method on the same
object is going to result in ... your __call() method getting called
again. You need to map the $method to whichever class methods you
*actually* want to call, instead of blindly trying to reissue the
call.

Regards
Peter


-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
On Sun, May 9, 2010 at 3:25 PM, Peter Lind <peter.e.l...@gmail.com> wrote:

> On 9 May 2010 23:21, Daniel Kolbo <kolb0...@umn.edu> wrote:
> > Hello,
> >
> > I've defined a __call() method inside a class.  Within the __call()
> > method (after testing that the method exists and is callable I am using:
> >
> > call_user_func_array(array($this,$method), $args);
> >
> > However, this seems to be an infinite loop (and is crashing my test
> > apache server).  How, could I still use the __call() method and avoid an
> > infinite loop of calling?
>
> Assuming that your __call() method was reached because no $method was
> defined, using call_user_func_array() to call $method on the same
> object is going to result in ... your __call() method getting called
> again. You need to map the $method to whichever class methods you
> *actually* want to call, instead of blindly trying to reissue the
> call.
>

according to op it sounds like hes not blindly reissuing the call,

(after testing that the method exists and is callable I am using:

anyways, Daniel, your code seems sound, hard to say where the recursion is
coming from.  why not just dump the methods youre trying to invoke via
var_dump() or error_log() etc?

eg
..
var_dump($method);
call_user_func_array(array($this,$method), $args);


-nathan

--- End Message ---
--- Begin Message ---
On 9 May 2010 23:56, Nathan Nobbe <quickshif...@gmail.com> wrote:
> On Sun, May 9, 2010 at 3:25 PM, Peter Lind <peter.e.l...@gmail.com> wrote:
>>
>> On 9 May 2010 23:21, Daniel Kolbo <kolb0...@umn.edu> wrote:
>> > Hello,
>> >
>> > I've defined a __call() method inside a class.  Within the __call()
>> > method (after testing that the method exists and is callable I am using:
>> >
>> > call_user_func_array(array($this,$method), $args);
>> >
>> > However, this seems to be an infinite loop (and is crashing my test
>> > apache server).  How, could I still use the __call() method and avoid an
>> > infinite loop of calling?
>>
>> Assuming that your __call() method was reached because no $method was
>> defined, using call_user_func_array() to call $method on the same
>> object is going to result in ... your __call() method getting called
>> again. You need to map the $method to whichever class methods you
>> *actually* want to call, instead of blindly trying to reissue the
>> call.
>
> according to op it sounds like hes not blindly reissuing the call,
> (after testing that the method exists and is callable I am using:

Good point that, misread. Would be good to see the code checking
availability of the method, to get some idea of the error.

Regards
Peter

-- 
<hype>
WWW: http://plphp.dk / http://plind.dk
LinkedIn: http://www.linkedin.com/in/plind
Flickr: http://www.flickr.com/photos/fake51
BeWelcome: Fake51
Couchsurfing: Fake51
</hype>

--- End Message ---
--- Begin Message ---
bcompiler is available, but with the correct tools data can still be extracted.
http://php.net/manual/en/book.bcompiler.php

On May 9, 2010, at 4:36 PM, shiplu wrote:

> Is there any php encoder like IonCube ?
> Looking for an opensource solution.
> My main target is to deliver encoded php codes so that it can not be
> re-engineered.
> 
> 
> 
> Shiplu Mokadd.im
> My talks, http://talk.cmyweb.net
> Follow me, http://twitter.com/shiplu
> SUST Programmers, http://groups.google.com/group/p2psust
> Innovation distinguishes bet ... ... (ask Steve Jobs the rest)
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 


--- End Message ---
--- Begin Message ---
On Mon, May 10, 2010 at 6:28 AM, donald sullivan <don...@nixspot.com> wrote:
> bcompiler is available, but with the correct tools data can still be 
> extracted.
> http://php.net/manual/en/book.bcompiler.php
>
Its not a problem if data can still be extracted. But I guess exact
data can not be extracted.
If thats the case its okay. Sometimes an obfuscated code is enough to
protect it.

As far I remember I heard somewhere it can be achieved by e-accelerator somehow.
How is it possible?


Shiplu Mokadd.im
My talks, http://talk.cmyweb.net
Follow me, http://twitter.com/shiplu
SUST Programmers, http://groups.google.com/group/p2psust
Innovation distinguishes bet ... ... (ask Steve Jobs the rest)

--- End Message ---
--- Begin Message ---
Greetings all,

 

This question basically surrounds how you structure your PHP applications,
whether it changes depending on what you're doing and which you'd favour. I
have a feeling it'll come down to a question of personal taste, but on the
off-chance there's a best practice I'll ask anyways.

 

>From what I've seen and used, there seem to be three distinct ways of going
about it.

 

1)      Using a 'core' class which has a request handler in it. All pages in
the site are accessed through that one page, e.g.

 

http://www.somesite.com/index.php?page=ViewUser
http://www.somesite.com/index.php?page=ViewProduct

 

This is one that I've personally used most after becoming familiar with a
bulletin board system several years ago. It means that pages are easily
created as all the template/session/database handling is done by the central
class.

 

2)      Using SE friendly URL's like:

 

http://www.somesite.com/products/22012/cool-game/
http://www.somesite.com/products/22013/other-game/

 

This approach seems to be becoming more common on the sites I frequent,
however by accounts I've read it seems to be more intensive on apache as it
requires a mod-rewrite function. 

 

3)      Using different PHP files for each page:

 

http://www.somesite.com/viewproduct.php?product=....
http://www.somesite.com/viewuser.php?user=...

 

This would appear to be the least developer friendly option?

 

Hopefully someone can shed some insight into which is the recommended
approach and why. I've been building bigger and bigger sites so having a
solid foundation is becoming more and more important.

 

Thanks for any help/feedback, I hope I've been clear.

 

Alex.


--- End Message ---

Reply via email to