Re: [PHP] Question on PHP 6 and static calls to instance methods.

2008-05-03 Thread Robert Cummings
You would have better luck posing this question to the internals list:

[EMAIL PROTECTED]

Cheers,
Rob.


On Sat, 2008-05-03 at 17:32 -0400, Adam Richardson wrote:
> I've incorporated use of the ability to call instance methods through  
> static calls, allowing for me to mimic multiple inheritance without  
> having to make edits to classes that are already working because of  
> the behavior of '$this' when instance methods are called statically.
> 
> As stated on in the basics section on classes and objects:
> 
> "$this is a reference to the calling object (usually the object to  
> which the method belongs, but can be another object, if the method is  
> called statically from the context of a secondary object)."
> 
> I've made great use of that functionality in my framework.  However,  
> It sounds like this is going to cause a fatal error in PHP6.  Is this  
> in fact true?  And, if the behavior is going to change, can somebody  
> explain what the impetus for this change was?
> 
> Thank you very much for your time,
> 
> Adam
> 
> Adam Richardson
> Envision Internet Consulting, LLC
> Phone: (517)623-0485
> 
> Services and insight for building effective, user-oriented websites.
> 
> 
> 
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Execute command from web browser

2008-05-03 Thread Casey
On 5/3/08, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
>  Hi all
>
>
>  I try write a code to execute service in my server from web browser
>
>  I write next
>
>  /var/www/html/squidup.html
Should it be... squidup.php?
>exec ('/usr/bin/squid/sbin/squid')
>  echo "Squid UP"
>  ?>
>
>  but, don't work from web browser.
>
>  What is wrong
>
>  Thanks,
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
-Casey

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



[PHP] Execute command from web browser

2008-05-03 Thread opc

Hi all


I try write a code to execute service in my server from web browser

I write next

/var/www/html/squidup.html


but, don't work from web browser.

What is wrong

Thanks,

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



Re: [PHP] new $foo->className(); Class name must be a valid object or a string

2008-05-03 Thread Casey


On May 3, 2008, at 4:46 PM, Jack Bates <[EMAIL PROTECTED]> wrote:


I am trying to load PHP objects stored in a database, where the class
name is stored in a column:

$object = new $resultSet->getString(1);

This fails for the same reason that the following fails:

className();

Fatal error: Class name must be a valid object or a string in test.php
on line 12

I guess this error is due to the confusion of parsing "()" as the
argument list for the "className" function, or the "Foo"  
constructor...


I work around this error by using a temp variable:

$tmp = $foo->className(); $bar = new $tmp;

- however the above reads like hacky code : (

When calling dynamically named functions, I generally use
call_user_func() to avoid awkwardness with $object->$tmp($arg1, ...)

In other words, I prefer:

call_user_func(array($object, 'get'.$someName), $arg1, ...);

- to:

$tmp = 'get'.$someName; $object->$tmp($arg1, ...);

However there does not appear to be an analog of call_user_func() for
constructing new instances of dynamically named classes?

If I recall correctly, there was also a way to work around calling
dynamically named functions (e.g. $object->$tmp($arg1, ...);) using
curly braces:

$object->{'get'.$someName}($arg1, ...);

- however I cannot recall the exact syntax.

Can anyone confirm that there is a curly brace syntax for calling
dynamically named functions? Could it be applied to instantiating
dynamically named classes?

Can anyone recommend a cleaner alternative to:

$tmp = $foo->className(); $bar = new $tmp;

Thanks and best wishes, Jack


Does...
className()();
?>
...work?

Otherwise, I'd just do...
className();
 $bar = new $className;
?>
...instead of $tmp.


--
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] web based chat app

2008-05-03 Thread paragasu
On Sun, May 4, 2008 at 5:37 AM, Nitsan Bin-Nun <[EMAIL PROTECTED]> wrote:

> glad my posts are useful ;)
> anyway, you can register a channel on any server, so you dont have
> actually to run one by yourself, there are zillions of networks out there
> that are just waiting for you. you can also check pjirc, it is a jave applet
> for online irc chat, its pretty integrate-able, you can change the
> background and the whole look to feat your website, also the language, even
> Hebrew is supported :D
>
> HTH,
> Nitsan
>
>

i did try to find  opensource php + AJAX  base IRC client. but found none.
but there is a PEAR library available to connect to IRC server.  i will look
into it
and try to  write some IRC client. it gonna be fun ;)


Re: [PHP] new $foo->className(); Class name must be a valid object or a string

2008-05-03 Thread Stut

On 4 May 2008, at 00:46, Jack Bates wrote:

I am trying to load PHP objects stored in a database, where the class
name is stored in a column:

$object = new $resultSet->getString(1);

This fails for the same reason that the following fails:

className();


I would rather have a factory method that returns a new instance of  
the class. There's no need for the outside world to know the class name.


test('foo');
  $bar = $foo->newInstance();
  $bar->test('bar');
?>

However, if you insist on doing it your way can I make a small  
suggestion? It's better to spend your time on functionality rather  
than finding ways to save some typing. I see no reason to try to  
combine the two statements - saving typing and a pitiful amount of  
disk space are the only benefits.


-Stut

--
http://stut.net/

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



[PHP] new $foo->className(); Class name must be a valid object or a string

2008-05-03 Thread Jack Bates
I am trying to load PHP objects stored in a database, where the class
name is stored in a column:

$object = new $resultSet->getString(1);

This fails for the same reason that the following fails:

className();

Fatal error: Class name must be a valid object or a string in test.php
on line 12

I guess this error is due to the confusion of parsing "()" as the
argument list for the "className" function, or the "Foo" constructor...

I work around this error by using a temp variable:

$tmp = $foo->className(); $bar = new $tmp;

- however the above reads like hacky code : (

When calling dynamically named functions, I generally use
call_user_func() to avoid awkwardness with $object->$tmp($arg1, ...)

In other words, I prefer:

call_user_func(array($object, 'get'.$someName), $arg1, ...);

- to:

$tmp = 'get'.$someName; $object->$tmp($arg1, ...);

However there does not appear to be an analog of call_user_func() for
constructing new instances of dynamically named classes?

If I recall correctly, there was also a way to work around calling
dynamically named functions (e.g. $object->$tmp($arg1, ...);) using
curly braces:

$object->{'get'.$someName}($arg1, ...);

- however I cannot recall the exact syntax.

Can anyone confirm that there is a curly brace syntax for calling
dynamically named functions? Could it be applied to instantiating
dynamically named classes?

Can anyone recommend a cleaner alternative to:

$tmp = $foo->className(); $bar = new $tmp;

Thanks and best wishes, Jack


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



Re: [PHP] web based chat app

2008-05-03 Thread Nitsan Bin-Nun
glad my posts are useful ;)
anyway, you can register a channel on any server, so you dont have actually
to run one by yourself, there are zillions of networks out there that are
just waiting for you. you can also check pjirc, it is a jave applet for
online irc chat, its pretty integrate-able, you can change the background
and the whole look to feat your website, also the language, even Hebrew is
supported :D

HTH,
Nitsan

On 03/05/2008, paragasu <[EMAIL PROTECTED]> wrote:
>
>
>
>  On Fri, May 2, 2008 at 4:42 AM, Nitsan Bin-Nun <[EMAIL PROTECTED]>
> wrote:
>
> > umm sorry for interupting but RTFM / STFM?
> >
> > btw, if you dont need history you can write an webby irc client
> >
> >
> >   On 01/05/2008, paragasu <[EMAIL PROTECTED]> wrote:
> > >
> > > > you build one. Thats the point of it wasn't it eh?
> > > > A friend and I made a chat with jabber throught second life (the
> > > game) and
> > > > a
> > > > php webpage.
> > >
> > >
> > > interesting. i really wan't to try out your chat implementation. may
> > > i?
> > > i don't know how to integrate php with jabber since *i don't have much
> > > understanding
> > > *on how jabber works.. :).. may give me some idea..
> > >
> >
> wow.. good idea. i  overlook this option.  actually, irc server is a good
> option..  tq
>
>
>


[PHP] Question on PHP 6 and static calls to instance methods.

2008-05-03 Thread Adam Richardson
I've incorporated use of the ability to call instance methods through  
static calls, allowing for me to mimic multiple inheritance without  
having to make edits to classes that are already working because of  
the behavior of '$this' when instance methods are called statically.


As stated on in the basics section on classes and objects:

"$this is a reference to the calling object (usually the object to  
which the method belongs, but can be another object, if the method is  
called statically from the context of a secondary object)."


I've made great use of that functionality in my framework.  However,  
It sounds like this is going to cause a fatal error in PHP6.  Is this  
in fact true?  And, if the behavior is going to change, can somebody  
explain what the impetus for this change was?


Thank you very much for your time,

Adam

Adam Richardson
Envision Internet Consulting, LLC
Phone: (517)623-0485

Services and insight for building effective, user-oriented websites.





[PHP] Question on PHP 6 and static calls to instance methods.

2008-05-03 Thread Adam Richardson

I have a quick question on what's coming in PHP 6.

I've incorporated use of the ability to call instance methods through  
static calls, allowing for me to mimic multiple inheritance without  
having to make edits to classes that are already working because of  
the behavior of '$this' when instance methods are called statically.


As stated on in the basics section on classes and objects:

"$this is a reference to the calling object (usually the object to  
which the method belongs, but can be another object, if the method is  
called statically from the context of a secondary object)."


I've made great use of that functionality in my framework.  However,  
It sounds like this is going to cause a fatal error in PHP6.  Is this  
in fact true?  And, if the behavior is going to change, can somebody  
explain what the impetus for this change was?


Thank you very much for your time,

Adam

Adam Richardson
Envision Internet Consulting, LLC
Phone: (517)623-0485

Services and insight for building effective, user-oriented websites.





RE: [PHP] Complex escape string

2008-05-03 Thread Steven R. Ringwald
-Original Message-
From: cyaugin [mailto:[EMAIL PROTECTED] 
Sent: Saturday, May 03, 2008 10:20 AM
To: php-general@lists.php.net
Subject: [PHP] Complex escape string

I have this line of code:

$q = "This is the string that will go into the query:
{${mysql_real_escape_string($_GET['searchstring'])}}";

What happens then is the user supplies 'foo' as the search string, and I get
a debug notice "Undefined variable: foo". Why is it treating the value as an
identifier and how do I make it do what I actually want it to do? This is on
PHP5, latest release.




---

It looks to me like what is happening is this piece:
${mysql_real_escape_string($_GET['searchstring'])}

Gets collapsed to $foo when mysql_real_escape_string($_GET['searchstring'])
== 'foo'. ${'a'} will expand to $a. I think that your problem is that you
need to drop that '$' before the brace around the function call.





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



Re: [PHP] Complex escape string

2008-05-03 Thread Craige Leeder
Why exactly are you doing this? While variable-variables can be of use
at times, I don't think this is one of them. How do you use this newly
created variable.

- Craige

On Sat, May 3, 2008 at 1:20 PM, cyaugin <[EMAIL PROTECTED]> wrote:
> I have this line of code:
>
>  $q = "This is the string that will go into the query:
>  {${mysql_real_escape_string($_GET['searchstring'])}}";
>
>  What happens then is the user supplies 'foo' as the search string, and I get
>  a debug notice "Undefined variable: foo". Why is it treating the value as an
>  identifier and how do I make it do what I actually want it to do? This is on
>  PHP5, latest release.
>
>
>
>  --
>  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 to create accessible by PHP

2008-05-03 Thread David Otton
2008/5/3 Todd Cary <[EMAIL PROTECTED]>:
> Are there any examples of creating a dll that can be placed in the dll
> directory of php that can be accessed by php?  My language would be Delphi,
> however an example in C would suffice.

Custom PHP extensions. I don't know of any Delphi-specific examples,
but this link might give you a starting point:

http://uk.php.net/manual/en/internals2.php

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



Re: [PHP] Complex escape string

2008-05-03 Thread Casey
On 5/3/08, cyaugin <[EMAIL PROTECTED]> wrote:
> I have this line of code:
>
>  $q = "This is the string that will go into the query:
>  {${mysql_real_escape_string($_GET['searchstring'])}}";
>
>  What happens then is the user supplies 'foo' as the search string, and I get
>  a debug notice "Undefined variable: foo". Why is it treating the value as an
>  identifier and how do I make it do what I actually want it to do? This is on
>  PHP5, latest release.
>
>
>
>
>  --
>  PHP General Mailing List (http://www.php.net/)
>  To unsubscribe, visit: http://www.php.net/unsub.php
>
>
$q = "This is the string that will go into the query: " .
mysql_real_escape_string($_GET['searchstring']);

-- 
-Casey

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



[PHP] Complex escape string

2008-05-03 Thread cyaugin
I have this line of code:

$q = "This is the string that will go into the query:
{${mysql_real_escape_string($_GET['searchstring'])}}";

What happens then is the user supplies 'foo' as the search string, and I get
a debug notice "Undefined variable: foo". Why is it treating the value as an
identifier and how do I make it do what I actually want it to do? This is on
PHP5, latest release.



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



[PHP] Re: How to create accessible by PHP

2008-05-03 Thread Todd Cary

Todd Cary wrote:
Are there any examples of creating a dll that can be placed in the dll 
directory of php that can be accessed by php?  My language would be 
Delphi, however an example in C would suffice.


Many thanks...

Todd

Sorry about my typo in the Subject!

Todd

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



[PHP] How to create accessible by PHP

2008-05-03 Thread Todd Cary
Are there any examples of creating a dll that can be placed in 
the dll directory of php that can be accessed by php?  My 
language would be Delphi, however an example in C would suffice.


Many thanks...

Todd

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



Re: [PHP] web based chat app

2008-05-03 Thread paragasu
On Fri, May 2, 2008 at 4:42 AM, Nitsan Bin-Nun <[EMAIL PROTECTED]> wrote:

> umm sorry for interupting but RTFM / STFM?
>
> btw, if you dont need history you can write an webby irc client
>
>
> On 01/05/2008, paragasu <[EMAIL PROTECTED]> wrote:
> >
> > > you build one. Thats the point of it wasn't it eh?
> > > A friend and I made a chat with jabber throught second life (the game)
> > and
> > > a
> > > php webpage.
> >
> >
> > interesting. i really wan't to try out your chat implementation. may i?
> > i don't know how to integrate php with jabber since *i don't have much
> > understanding
> > *on how jabber works.. :).. may give me some idea..
> >
>
wow.. good idea. i  overlook this option.  actually, irc server is a good
option..  tq


Re: [PHP] Any Running Simple Ajax Sample for Php

2008-05-03 Thread paragasu
On Sat, May 3, 2008 at 4:31 AM, Jon L. <[EMAIL PROTECTED]> wrote:

> If you aren't already, I recommend putting to use a JS library with Ajax
> support.
> Nothing else, they can reduce the browser compatibility overhead coding
> you'll need to do.
>
> You can pick any of many, but I'm more familiar with Prototype:
> http://prototypejs.org/
>
> ## credits.php
> 
>  /* ... */  // determine value for $credits
> print min($credits, 0);
> ?>
>
> ## credits.html
> -
> 
>  
>Checking credits...
>
>
>
>/*** Reference ***/
> http://prototypejs.org/api/periodicalExecuter
> http://prototypejs.org/api/ajax/request
> http://prototypejs.org/api/element/observe
>
>function creditsCheck(pe) {
>  new Ajax.Request('foobar.php', {
>method: 'get',
>parameters: {ts: (new Date()).getTime()}, // cache prevention
>onSuccess: function (transport) {
>  var elem = $('credits');
>  if (Number(transport.responseText) > 0) {
>elem.update('Credits remaining: ' + transport.responseText);
>  } else {
>elem.update('Credits have expired.').setStyle({background:
> '#f00'});
>pe.stop();
>  }
>},
>onFailure: function () {
>  $('credits').update('Could not determine
> credits.').setStyle({background: '#f00'});
>}
>  });
>}
>
>document.observe('dom:loaded', function () {
>  var pe = new PeriodicalExecuter(creditsCheck, 60);
>  creditsCheck(pe); // first check
>});
>
>  
> 
>
> - Jon L.
>
> On Fri, May 2, 2008 at 4:13 AM, Heysem KAYA <[EMAIL PROTECTED]>
> wrote:
>
> > Hi,
> >
> > I would like to check each minute whether the user credit is finished
> and
> > update the relevant place on page. So I have downloaded however was not
> > able
> > to run some sample ajax code.
> >
> > Is there anyone who has such a simple code to implement?
> >
> >
> >
> > Thanks,
> >
> >
> >
> > Heysem Kaya
> >
> >
>

jQuery library also can do AJAX thing in relatively simple way. check
jquery.com


Re: [PHP] XHTML/CSS problem

2008-05-03 Thread Per Jessen
jeroen vannevel wrote:

> have a look at www.speedzor.com/woopsie.php, and please tell me where
> my problem is. i'm stuck at this for hours by now :p
> 
> thanks in advance,
> jeroen

And the problem is?  Your page looks fine to me. 


/Per Jessen, Zürich


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



Re: [PHP] Apache child pid segfault + APD

2008-05-03 Thread Mario Guenterberg
On Fri, May 02, 2008 at 10:24:03PM -0700, Waynn Lue wrote:

> *** glibc detected *** free(): invalid pointer: 0x002a9956d000 ***

Hi Waynn,

try to use xdebug instead of APD to profile you app. There is a problem with 
your glibc
version and your APD version.

In my environment php 5.2.6 with suhosin/apc, apache 2.2.8 and xdebug 2.0.2 it 
works fine.

Greetings
Mario

-- 
-BEGIN GEEK CODE BLOCK-
Version: 3.12
GCS/CM d- s++: a+ C>$ UBL*$ P++ L+++ E--- W+++ N+ o-- K- w O- M-
V-- PS++ PE++ Y PGP+++ t--- 5 X R++ tv- b+++ DI D  G++ e* h
r+++ y
--END GEEK CODE BLOCK--

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