Re: [PHP] PHP SOAP Using SAML

2009-06-22 Thread Karel Kozlik

 Hi,
take a look to Lasso. They claims it support SAML 2.0.
http://lasso.entrouvert.org/

Karel

Carlos Medina napsal(a):

Hi Anybody,
I am evaluating to use Webservices to solve an knowed Issue. I need to 
know, if it is Possible to use SAML 1.0 with PHP 4 or PHP 5 and when 
yes, where can i get information about this Issue or open Source 
Software,etc.




Regards

Carlos



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



Re: [PHP] dynamicaly append method to class - workaround for aggregate_methods()

2009-03-20 Thread Karel Kozlik

 Hello,
thanks for the hint. It looks nice. Where could I learn more about
$class::$method() syntax? I was not successfull when searching in php 
manual.


 Btw. is it an intended behaviour that $class::$method() works in this
way? I mean that I would pressume that method is called in static
context and the $this should not be avaiable in the method than. So I
affraid a bit that the behaviour will be changed in the (near) future.

But there still remains two issues:
1. How to pass arguments to method? The number of arguments is different 
for each method. So is the only way to construct a string containing the 
arguments and use eval()? Or is there an another way?


2. Arguments sometimes need to be passed by reference. It seems that 
__call() does not support passing arguments by reference :(. So I have 
not idea how workaround it.


thanks,
Karel


Jochem Maas napsal(a):

Karel Kozlik schreef:

 Hello list!

I am using in my application dynamic method appending to class with
aggregate_methods() function. But this function is no more aviable in
php5 and runkit extension seems not to be maintained any more. So I
would like to replace it with something more common (__call method or so).

Just to describe the situation (simplified). There is one common class
containing some common functions:

class DataLayer{

function add_method($method){
aggregate_methods($this, DataLayer_.$method);
}

function common_funct_foo(){
...
}

function common_funct_bar(){
...
}
}


And there is hundreds of data manipulation methods (defined within
separate classes) which could call common functions. E.g.:


class DataLayer_get_items{
function get_items(){
$this-common_funct_foo();
return something;
}
}

And they could also call other dynamicaly added methods:

class DataLayer_update_attr{
function update_attr(){
$this-get_items();
$this-common_funct_bar();
return;
}
}

All the stuff is used e.g. in this way:

$data = new DataLayer();
$data-add_method('get_items');
$data-add_method('update_attr');
$data-update_attr();



Now the question is whether is it possible to somehow replace
functionality of add_method() without aggregate_methods() or
runkit_class_adopt(). And _WITHOUT_ need to change the hundreds of
DataLayer_* classes. The change should be only in the main DataLayer class.
 I was thinking about __call() method, but I do not know how to deal
with the $this in dynamicaly appended functions. I need somehow make to
$this in these functions reference to instance of DataLayer class.


__call() will allow you to do this, although you will need php5.3:

?php

class DataLayer_update_attr
{
function update_attr()
{
echo __METHOD__, \n;

$this-common_funct_bar();
$this-get_items();

return;
}
}


class DataLayer
{
function common_funct_foo() { echo __METHOD__, \n; /* ... */ }
function common_funct_bar() { echo __METHOD__, \n; /* ... */ }

function __call($method, $args)
{
$class = DataLayer_{$method};

echo __METHOD__,  ... trying {$class}::{$method}()\n;

if (!class_exists($class, true)) // trigger autoload
throw new Exception(buddy we don't have a $class, so $method is not 
callable);

$class::$method();
}
}

$d = new DataLayer;
$d-update_attr();

?
- output --

[22:11:16] jochem::~/test  ~/src/php5.3-200808312030/sapi/cli/php -n -f 
./class_agg.php
DataLayer::__call ... trying DataLayer_update_attr::update_attr()
DataLayer_update_attr::update_attr
DataLayer::common_funct_bar
DataLayer::__call ... trying DataLayer_get_items::get_items()

Fatal error: Uncaught exception 'Exception' with message 'buddy we don't have a 
DataLayer_get_items, so get_items is not
callable' in /Users/jochem/test/class_agg.php:30
Stack trace:
#0 [internal function]: DataLayer-__call('get_items', Array)
#1 /Users/jochem/test/class_agg.php(11): DataLayer-get_items()
#2 /Users/jochem/test/class_agg.php(32): DataLayer_update_attr-update_attr()
#3 [internal function]: DataLayer-__call('update_attr', Array)
#4 /Users/jochem/test/class_agg.php(37): DataLayer-update_attr()
#5 {main}
  thrown in /Users/jochem/test/class_agg.php on line 30



Any ideas?

many thanks,
Karel







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



Re: [PHP] dynamicaly append method to class - workaround for aggregate_methods()

2009-03-20 Thread Karel Kozlik



But there still remains two issues:
1. How to pass arguments to method? The number of arguments is different
for each method. So is the only way to construct a string containing the
arguments and use eval()? Or is there an another way?


then use call_user_func() and/or call_user_func_array() inside __call(),


I tryed it, but it unfortunately does not work. In this case the method 
is called in static context and the $this is not avaiable in the method.


I tryed both:
call_user_func_array(array($class, $method), $args);
and
call_user_func_array($class.::.$method, $args);


although given the seemingly 'broken' (mho) design and infinite variations that 
are
possible in terms of method argument invocation you might consider
tackling the whole system from a wider perspective (probably not what you want 
to
hear I guess)

also see: http://bugs.php.net/bug.php?id=40694

basically the by-ref issue is not, seemingly, really solvable - I'd say using 
by-ref
in most cases is unwarranted anyway ... but, you may be able to work round it 
by using
a static variable inconjunction with a, second, retrieval method in the
decorating classes that overcome the requirement for by-ref ... if that makes 
sense.



Hmmm I am not sure if I understand correctly, but I guess the use of 
second, retrieval method will require changes in all methods that use 
the by-ref arguments and also at all places where these methods are 
called. Am I right? Better doing this I will think how to change the 
whole design, but this is what I wanted to avoid.



thanks for your help
K.


looks like you have your work cut out for you!


2. Arguments sometimes need to be passed by reference. It seems that
__call() does not support passing arguments by reference :(. So I have
not idea how workaround it.

thanks,
Karel


Jochem Maas napsal(a):

Karel Kozlik schreef:

 Hello list!

I am using in my application dynamic method appending to class with
aggregate_methods() function. But this function is no more aviable in
php5 and runkit extension seems not to be maintained any more. So I
would like to replace it with something more common (__call method or
so).

Just to describe the situation (simplified). There is one common class
containing some common functions:

class DataLayer{

function add_method($method){
aggregate_methods($this, DataLayer_.$method);
}

function common_funct_foo(){
...
}

function common_funct_bar(){
...
}
}


And there is hundreds of data manipulation methods (defined within
separate classes) which could call common functions. E.g.:


class DataLayer_get_items{
function get_items(){
$this-common_funct_foo();
return something;
}
}

And they could also call other dynamicaly added methods:

class DataLayer_update_attr{
function update_attr(){
$this-get_items();
$this-common_funct_bar();
return;
}
}

All the stuff is used e.g. in this way:

$data = new DataLayer();
$data-add_method('get_items');
$data-add_method('update_attr');
$data-update_attr();



Now the question is whether is it possible to somehow replace
functionality of add_method() without aggregate_methods() or
runkit_class_adopt(). And _WITHOUT_ need to change the hundreds of
DataLayer_* classes. The change should be only in the main DataLayer
class.
 I was thinking about __call() method, but I do not know how to deal
with the $this in dynamicaly appended functions. I need somehow make to
$this in these functions reference to instance of DataLayer class.

__call() will allow you to do this, although you will need php5.3:

?php

class DataLayer_update_attr
{
function update_attr()
{
echo __METHOD__, \n;

$this-common_funct_bar();
$this-get_items();

return;
}
}


class DataLayer
{
function common_funct_foo() { echo __METHOD__, \n; /* ... */ }
function common_funct_bar() { echo __METHOD__, \n; /* ... */ }

function __call($method, $args)
{
$class = DataLayer_{$method};

echo __METHOD__,  ... trying {$class}::{$method}()\n;

if (!class_exists($class, true)) // trigger autoload
throw new Exception(buddy we don't have a $class, so
$method is not callable);

$class::$method();
}
}

$d = new DataLayer;
$d-update_attr();

?
- output --

[22:11:16] jochem::~/test  ~/src/php5.3-200808312030/sapi/cli/php -n
-f ./class_agg.php
DataLayer::__call ... trying DataLayer_update_attr::update_attr()
DataLayer_update_attr::update_attr
DataLayer::common_funct_bar
DataLayer::__call ... trying DataLayer_get_items::get_items()

Fatal error: Uncaught exception 'Exception' with message 'buddy we
don't have a DataLayer_get_items, so get_items is not
callable' in /Users/jochem/test/class_agg.php:30
Stack trace:
#0 [internal function]: DataLayer-__call('get_items', Array)
#1 /Users/jochem/test/class_agg.php(11): DataLayer-get_items()
#2 /Users/jochem/test/class_agg.php(32

[PHP] dynamicaly append method to class - workaround for aggregate_methods()

2009-03-19 Thread Karel Kozlik

 Hello list!

I am using in my application dynamic method appending to class with 
aggregate_methods() function. But this function is no more aviable in 
php5 and runkit extension seems not to be maintained any more. So I 
would like to replace it with something more common (__call method or so).


Just to describe the situation (simplified). There is one common class 
containing some common functions:


class DataLayer{

function add_method($method){
aggregate_methods($this, DataLayer_.$method);
}

function common_funct_foo(){
...
}

function common_funct_bar(){
...
}
}


And there is hundreds of data manipulation methods (defined within 
separate classes) which could call common functions. E.g.:



class DataLayer_get_items{
function get_items(){
$this-common_funct_foo();
return something;
}
}

And they could also call other dynamicaly added methods:

class DataLayer_update_attr{
function update_attr(){
$this-get_items();
$this-common_funct_bar();
return;
}
}

All the stuff is used e.g. in this way:

$data = new DataLayer();
$data-add_method('get_items');
$data-add_method('update_attr');
$data-update_attr();



Now the question is whether is it possible to somehow replace 
functionality of add_method() without aggregate_methods() or 
runkit_class_adopt(). And _WITHOUT_ need to change the hundreds of 
DataLayer_* classes. The change should be only in the main DataLayer class.
 I was thinking about __call() method, but I do not know how to deal 
with the $this in dynamicaly appended functions. I need somehow make to 
$this in these functions reference to instance of DataLayer class.


Any ideas?

many thanks,
Karel


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



Re: [PHP] imap_mail_compose not working

2006-03-16 Thread Karel Kozlik


What version of imap do you have on both servers?

Maybe one is older and has some bugs that have been fixed.



Hi,
phpinfo on both servers reporting:
IMAP c-Client Version:  2001

The strange think is that imap_mail_compose were working on the windows 
server few months ago. But now when I need it again it not work.


Karel

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



[PHP] Re: Can I specify alternative php.ini in httpd.conf

2006-03-16 Thread Karel Kozlik

Khai napsal(a):

Hi All,

I am using php as an apache module.  In my httpd.conf, is there a way to 
specify which php.ini to use?


Thanks
Khai


Yes, add this line (with your own location of course) to httpd.conf

PHPIniDir c:/Program Files/Apache Group/php4

Karel

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



Re: [PHP] imap_mail_compose not working

2006-03-16 Thread Karel Kozlik

chris smith napsal(a):

On 3/16/06, Karel Kozlik [EMAIL PROTECTED] wrote:

What version of imap do you have on both servers?

Maybe one is older and has some bugs that have been fixed.


Hi,
phpinfo on both servers reporting:
IMAP c-Client Version:  2001

The strange think is that imap_mail_compose were working on the windows
server few months ago. But now when I need it again it not work.


So what was changed on the server ?


Unfortunately don't know - many things :-(

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



[PHP] imap_mail_compose not working

2006-03-15 Thread Karel Kozlik

 Hi All,
function imap_mail_compose() not working on my server. This script:

?
$envelope[From]=[EMAIL PROTECTED];
$envelope[To]=[EMAIL PROTECTED];

$part1[type]=TYPEMULTIPART;
$part1[subtype]=mixed;

$part2[type]=TYPETEXT;
$part2[subtype]=plain;
$part2[contents.data]=asdfjaskdfhjk;

$part3[type]=TYPETEXT;
$part3[subtype]=html;
$part3[contents.data]=sdafjaasdjkjdfka;

$body[1]=$part1;
$body[2]=$part2;
$body[3]=$part3;

echo$mail=imap_mail_compose($envelope, $body);
?

return only one line:
--117491828-5973-1142442255=:332--


altouch when I run this script on another server it correctly return this:


MIME-Version: 1.0
Content-Type: MULTIPART/mixed; 
BOUNDARY=-708698681-1804289383-1142442189=:14362


---708698681-1804289383-1142442189=:14362
Content-Type: TEXT/plain; CHARSET=US-ASCII

asdfjaskdfhjk
---708698681-1804289383-1142442189=:14362
Content-Type: TEXT/html; CHARSET=US-ASCII

sdafjaasdjkjdfka
---708698681-1804289383-1142442189=:14362--



I am trying php4 and php5 on windows but with no success.

Any ideas what may be wrong?

regards Karel

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



[PHP] what is better for performance?

2005-12-06 Thread Karel Kozlik

 Hi,
I am just thinking about that what is better for storeing structured 
variables in point of view of performance.


Is better store structured variables in associative array, for example:

$person['first_name'] = 'Karel';
$person['last_name'] = 'Kozlik';
$person['address'] = 'somewhere on Earth';

or in object like this:

$person-first_name = 'Karel';
$person-last_name = 'Kozlik';
$person-address = 'somewhere on Earth';

I feel that objects are better for performance, but work with 
associative arrays is pleasanter for me. May be the diference in 
performance measurable? (in heavy loaded environment)


thanks Karel

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



[PHP] Performance issues

2002-12-12 Thread KaReL
I'm having a lot of trouble with loading times...

Let me explain in detail:

I've a full  huge coded website based upon a mysql database...

mysql entries: at least 2M
php code: at least 1M lines (longest file about 25k, without includes)

about 2 months ago we resetted the entire database and reworked a part of
the code (nothing really essential).

And now we are experiencing a really heavy load on the server. (no root
access, but we think it's PHP).


What reasons could there be for that?


BTW if I was pretty unclear about what I said in here, please ask... I know
my english ain't that well ;)



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




Re: [PHP] Performance issues

2002-12-12 Thread KaReL
1megabyte of code :)
not 1M lines

sorry about that confusion there


and the problem began slow, not noticable... But it's now worse then ever.

Jon Haworth [EMAIL PROTECTED] wrote in message
67DF9B67CEFAD4119E4200D0B720FA3F0241E995@BOOTROS">news:67DF9B67CEFAD4119E4200D0B720FA3F0241E995@BOOTROS...
 Hi Karel,

  mysql entries: at least 2M
  php code: at least 1M lines

 More than a million lines of code? That's a *big* app.

  And now we are experiencing a really heavy
  load on the server. (no root access, but we think
  it's PHP).

 You're running it on a server with no root access? Is it a shared server?
If
 you're running a 1,000,000 LOC app I'd expect it to have enough traffic
 that a dedicated box would be a necessity.

 Have you looked at the output from top when the load is getting too heavy?
 This will tell you which processes are tying up the processor.

 Did the heavy load happen immediately after your code change? If so then
 that might be a culprit... are there any chunks of code you can roll back
to
 the old version to see if the load decreasese? (e.g. have you modified a
bit
 to use a *lot* of string concatenation, or something?)

 Cheers
 Jon



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




[PHP] create object from variable class.

2002-07-24 Thread Karel de groot

Is it possible to create an object from a clas which name is in a variable.

Example: (doesn't work)
$object = new ${$classname};





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