php-general Digest 9 Feb 2010 21:05:38 -0000 Issue 6582

2010-02-09 Thread php-general-digest-help

php-general Digest 9 Feb 2010 21:05:38 - Issue 6582

Topics (messages 301897 through 301912):

Re: howto do informative error handling without the fatalities
301897 by: Rene Veerman
301898 by: Teus Benschop
301899 by: Nathan Rixham
301900 by: Richard Quadling
301901 by: Richard
301902 by: Richard Quadling
301903 by: Richard
301904 by: Robert Cummings
301905 by: Ashley Sheridan
301906 by: Robert Cummings
301908 by: Richard Quadling
301910 by: Richard

create archive file in memory with zipArchive class
301907 by: Ryan Sun
301909 by: Richard Quadling
301911 by: Ryan Sun

SOAP connect error
301912 by: Eric Lommatsch

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


--
---BeginMessage---
I would also like to hear suggestions on how to fix this mess:

$r = funcA ( funcB ( funcC ( $p ) ) );

if funcB() / funcC() fails, how would you fudge/abort the calling
function in the chain?
One may think that funcA and funcB just check their parameters list
for being error arrays, but the problem i foresee is that depending
on the context of the $r= call, desired behaviour may vary at any
stage in the funcA - funcB - funcC chain.
---End Message---
---BeginMessage---
On Tue, 2010-02-09 at 07:22 +0100, Rene Veerman wrote:
 I would also like to hear suggestions on how to fix this mess:
 
 $r = funcA ( funcB ( funcC ( $p ) ) );
 
 if funcB() / funcC() fails, how would you fudge/abort the calling
 function in the chain?
 One may think that funcA and funcB just check their parameters list
 for being error arrays, but the problem i foresee is that depending
 on the context of the $r= call, desired behaviour may vary at any
 stage in the funcA - funcB - funcC chain.
 
I would abort it by embedding the mess in a try.. catch statement, then
throwing an exception. Teus.
---End Message---
---BeginMessage---
Rene Veerman wrote:
 Hi,
 
 I'm looking for a strategy to do informative error handling at all
 levels of my code, yet keep these errors non-fatal as often as
 possible.

error_log - for logging errors
throw Exception - for show stoppers
try/catch - for when you can handle a potential show stopper

custom error logging / messaging can easily be achieved with something
like this:

?php

class Messenger
{

  private static $_messages = array();

  public static function addMessage( $string )
  {
self::$_messages[] = $string;
if( $string instanceof Exception ) {
  echo self::report();
}
  }

  public static function report()
  {
return implode( PHP_EOL , self::$_messages );
  }

}

set_exception_handler( 'Messenger::addMessage' );

Messenger::addMessage( 'little error report 1' );
Messenger::addMessage( 'little error report 2' );
Messenger::addMessage( 'little error report 3' );
throw new Exception( 'this will stop the script' );
// exception will kill the script; if you comment it out
// or wrap it in a try catch then you can keep going..
Messenger::addMessage( 'little error report 4' );
// try catch exceptions and report them like this..
try {
  throw new Exception( 'we could catch this' );
} catch ( Exception $e ) {
  Messenger::addMessage( $e );
}
Messenger::addMessage( 'little error report 5' );
// and when your done just echo it out or save it or..
echo Messenger::report();


Regards!
---End Message---
---BeginMessage---
On 9 February 2010 11:48, Nathan Rixham nrix...@gmail.com wrote:
 Rene Veerman wrote:
 Hi,

 I'm looking for a strategy to do informative error handling at all
 levels of my code, yet keep these errors non-fatal as often as
 possible.

 error_log - for logging errors
 throw Exception - for show stoppers
 try/catch - for when you can handle a potential show stopper

 custom error logging / messaging can easily be achieved with something
 like this:

 ?php

 class Messenger
 {

  private static $_messages = array();

  public static function addMessage( $string )
  {
    self::$_messages[] = $string;
    if( $string instanceof Exception ) {
      echo self::report();
    }
  }

  public static function report()
  {
    return implode( PHP_EOL , self::$_messages );
  }

 }

 set_exception_handler( 'Messenger::addMessage' );

 Messenger::addMessage( 'little error report 1' );
 Messenger::addMessage( 'little error report 2' );
 Messenger::addMessage( 'little error report 3' );
 throw new Exception( 'this will stop the script' );
 // exception will kill the script; if you comment it out
 // or wrap it in a try catch then you can keep going..
 Messenger::addMessage( 'little error report 4' );
 // try catch exceptions and report them like this..
 try {
  throw new Exception( 'we could catch 

[PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Nathan Rixham
Rene Veerman wrote:
 Hi,
 
 I'm looking for a strategy to do informative error handling at all
 levels of my code, yet keep these errors non-fatal as often as
 possible.

error_log - for logging errors
throw Exception - for show stoppers
try/catch - for when you can handle a potential show stopper

custom error logging / messaging can easily be achieved with something
like this:

?php

class Messenger
{

  private static $_messages = array();

  public static function addMessage( $string )
  {
self::$_messages[] = $string;
if( $string instanceof Exception ) {
  echo self::report();
}
  }

  public static function report()
  {
return implode( PHP_EOL , self::$_messages );
  }

}

set_exception_handler( 'Messenger::addMessage' );

Messenger::addMessage( 'little error report 1' );
Messenger::addMessage( 'little error report 2' );
Messenger::addMessage( 'little error report 3' );
throw new Exception( 'this will stop the script' );
// exception will kill the script; if you comment it out
// or wrap it in a try catch then you can keep going..
Messenger::addMessage( 'little error report 4' );
// try catch exceptions and report them like this..
try {
  throw new Exception( 'we could catch this' );
} catch ( Exception $e ) {
  Messenger::addMessage( $e );
}
Messenger::addMessage( 'little error report 5' );
// and when your done just echo it out or save it or..
echo Messenger::report();


Regards!

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Richard Quadling
On 9 February 2010 11:48, Nathan Rixham nrix...@gmail.com wrote:
 Rene Veerman wrote:
 Hi,

 I'm looking for a strategy to do informative error handling at all
 levels of my code, yet keep these errors non-fatal as often as
 possible.

 error_log - for logging errors
 throw Exception - for show stoppers
 try/catch - for when you can handle a potential show stopper

 custom error logging / messaging can easily be achieved with something
 like this:

 ?php

 class Messenger
 {

  private static $_messages = array();

  public static function addMessage( $string )
  {
    self::$_messages[] = $string;
    if( $string instanceof Exception ) {
      echo self::report();
    }
  }

  public static function report()
  {
    return implode( PHP_EOL , self::$_messages );
  }

 }

 set_exception_handler( 'Messenger::addMessage' );

 Messenger::addMessage( 'little error report 1' );
 Messenger::addMessage( 'little error report 2' );
 Messenger::addMessage( 'little error report 3' );
 throw new Exception( 'this will stop the script' );
 // exception will kill the script; if you comment it out
 // or wrap it in a try catch then you can keep going..
 Messenger::addMessage( 'little error report 4' );
 // try catch exceptions and report them like this..
 try {
  throw new Exception( 'we could catch this' );
 } catch ( Exception $e ) {
  Messenger::addMessage( $e );
 }
 Messenger::addMessage( 'little error report 5' );
 // and when your done just echo it out or save it or..
 echo Messenger::report();


 Regards!

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



I have extended the standard exception class to send me an email
whenever an exception occurs.

I treat all errors on the live system as exceptions. They shouldn't
occur. If they do, I've missed something.

But at least I'll get a near instant notification of the issue, along
with the stack and all the params involved.

Very useful.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Richard
Hi,

 I have extended the standard exception class to send me an email
 whenever an exception occurs.

I did that once. Once being the operative word... :-) Ended up with
tens of thousands of emails one morning. At first I thought... Wow,
maybe my popularity has grown somewhat. But it hadn't.

-- 
Richard Heyes
HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 31st January)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Richard Quadling
On 9 February 2010 12:55, Richard rich...@php.net wrote:
 Hi,

 I have extended the standard exception class to send me an email
 whenever an exception occurs.

 I did that once. Once being the operative word... :-) Ended up with
 tens of thousands of emails one morning. At first I thought... Wow,
 maybe my popularity has grown somewhat. But it hadn't.

 --
 Richard Heyes
 HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 31st January)
 Lots of PHP and Javascript code - http://www.phpguru.org


But I bet you REALLY quickly fixed the problem!

Oh. BTW. Thanks for RMail (previously known as htmlmimemail5 if anyone
else is interested).



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Richard
Hi,

 But I bet you REALLY quickly fixed the problem!

I just took out the error handling. :-)

-- 
Richard Heyes
HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 7th February)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Robert Cummings

Richard wrote:

Hi,


I have extended the standard exception class to send me an email
whenever an exception occurs.


I did that once. Once being the operative word... :-) Ended up with
tens of thousands of emails one morning. At first I thought... Wow,
maybe my popularity has grown somewhat. But it hadn't.


I have something similar... a cron job that checks the error_log file 
every 10 minutes and sends me the contents if any exist. I also set a 
special header so I can be sure it's not spam and appropriately route it 
into my mail folder maze, Much less spammy :)


Cheers,
Rob.
--
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] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Ashley Sheridan
On Tue, 2010-02-09 at 09:19 -0500, Robert Cummings wrote:

 Richard wrote:
  Hi,
  
  I have extended the standard exception class to send me an email
  whenever an exception occurs.
  
  I did that once. Once being the operative word... :-) Ended up with
  tens of thousands of emails one morning. At first I thought... Wow,
  maybe my popularity has grown somewhat. But it hadn't.
 
 I have something similar... a cron job that checks the error_log file 
 every 10 minutes and sends me the contents if any exist. I also set a 
 special header so I can be sure it's not spam and appropriately route it 
 into my mail folder maze, Much less spammy :)
 
 Cheers,
 Rob.
 -- 
 http://www.interjinn.com
 Application and Templating Framework for PHP
 


Real developers don't have errors in their code; they're undocumented
features ;)

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




Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Robert Cummings

Ashley Sheridan wrote:

On Tue, 2010-02-09 at 09:19 -0500, Robert Cummings wrote:


Richard wrote:

Hi,


I have extended the standard exception class to send me an email
whenever an exception occurs.

I did that once. Once being the operative word... :-) Ended up with
tens of thousands of emails one morning. At first I thought... Wow,
maybe my popularity has grown somewhat. But it hadn't.
I have something similar... a cron job that checks the error_log file 
every 10 minutes and sends me the contents if any exist. I also set a 
special header so I can be sure it's not spam and appropriately route it 
into my mail folder maze, Much less spammy :)


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




Real developers don't have errors in their code; they're undocumented
features ;)


H... I've always gone with a wise man learns from his mistakes.

Not that I'm saying I'm wise or anything... just seems a good goal to 
shoot for :)


Cheers,
Rob.
--
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



[PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Ryan Sun
I want to generate credential zip file for user on the fly with
zipArchive and render it for download, so I created following code
-
$zip = new ZipArchive();
$filename = '/tmp/xxx.zip';
if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
 throw new Exception();
}
if($zip)
{
    $zip-addFromString('xxx.xx', $fileString);
}
$zip-close();
$fileString = file_get_contents($filename);
unlink($filename);

$this-getResponse()-setHeader('Content-Type', 'application/zip');
$this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
$this-getResponse()-setBody($fileString);
-
it works, but I think creating the file in memory is a better
approach, so I changed the 2nd lineI(using php 5.2.0) to
$filename = 'php://temp/xxx.zip';
then the php just won't archive the file and the file downloaded is
just a plain text file.

so
question 1, how to create zip Archive file in memory on the fly and
download it (I don't have to save it on disk)?
question 2, if there is no way to create in memory, is it safe to just
unlink() the file?

thanks in advance.

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Richard Quadling
On 9 February 2010 14:20, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

 On Tue, 2010-02-09 at 09:19 -0500, Robert Cummings wrote:

 Richard wrote:
  Hi,
 
  I have extended the standard exception class to send me an email
  whenever an exception occurs.
 
  I did that once. Once being the operative word... :-) Ended up with
  tens of thousands of emails one morning. At first I thought... Wow,
  maybe my popularity has grown somewhat. But it hadn't.

 I have something similar... a cron job that checks the error_log file
 every 10 minutes and sends me the contents if any exist. I also set a
 special header so I can be sure it's not spam and appropriately route it
 into my mail folder maze, Much less spammy :)

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


 Real developers don't have errors in their code; they're undocumented 
 features ;)

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



So, no documentation AND bugs!!! Gee. I really wouldn't want to rely
on that code base!

--
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Richard Quadling
On 9 February 2010 15:42, Ryan Sun ryansu...@gmail.com wrote:
 I want to generate credential zip file for user on the fly with
 zipArchive and render it for download, so I created following code
 -
 $zip = new ZipArchive();
 $filename = '/tmp/xxx.zip';
 if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
  throw new Exception();
 }
 if($zip)
 {
     $zip-addFromString('xxx.xx', $fileString);
 }
 $zip-close();
 $fileString = file_get_contents($filename);
 unlink($filename);

 $this-getResponse()-setHeader('Content-Type', 'application/zip');
 $this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
 $this-getResponse()-setBody($fileString);
 -
 it works, but I think creating the file in memory is a better
 approach, so I changed the 2nd lineI(using php 5.2.0) to
 $filename = 'php://temp/xxx.zip';
 then the php just won't archive the file and the file downloaded is
 just a plain text file.

 so
 question 1, how to create zip Archive file in memory on the fly and
 download it (I don't have to save it on disk)?
 question 2, if there is no way to create in memory, is it safe to just
 unlink() the file?

 thanks in advance.

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



According to http://docs.php.net/manual/en/wrappers.php.php, it looks
like you should be using ...

$filename = 'php://temp';

That's it.

The actual file name is not your job.



-- 
-
Richard Quadling
Standing on the shoulders of some very clever giants!
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Richard
Hi,

 Real developers don't have errors in their code; they're undocumented 
 features ;)

Or alternatively, if you freelance - Forthcoming employment opportunities :-)

-- 
Richard Heyes
HTML5 canvas graphing: RGraph - http://www.rgraph.net (updated 7th February)
Lots of PHP and Javascript code - http://www.phpguru.org

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



Re: [PHP] create archive file in memory with zipArchive class

2010-02-09 Thread Ryan Sun
thanks, Richard, maybe you are right, the actual file name is not my job
I changed it to 'php://temp' but its still the same, nothing has been changed...

On Tue, Feb 9, 2010 at 11:13 AM, Richard Quadling
rquadl...@googlemail.com wrote:
 On 9 February 2010 15:42, Ryan Sun ryansu...@gmail.com wrote:
 I want to generate credential zip file for user on the fly with
 zipArchive and render it for download, so I created following code
 -
 $zip = new ZipArchive();
 $filename = '/tmp/xxx.zip';
 if ($zip-open($filename, ZIPARCHIVE::CREATE)!==TRUE) {
  throw new Exception();
 }
 if($zip)
 {
     $zip-addFromString('xxx.xx', $fileString);
 }
 $zip-close();
 $fileString = file_get_contents($filename);
 unlink($filename);

 $this-getResponse()-setHeader('Content-Type', 'application/zip');
 $this-getResponse()-setHeader('Content-Disposition','attachment;filename=xxx.zip');
 $this-getResponse()-setBody($fileString);
 -
 it works, but I think creating the file in memory is a better
 approach, so I changed the 2nd lineI(using php 5.2.0) to
 $filename = 'php://temp/xxx.zip';
 then the php just won't archive the file and the file downloaded is
 just a plain text file.

 so
 question 1, how to create zip Archive file in memory on the fly and
 download it (I don't have to save it on disk)?
 question 2, if there is no way to create in memory, is it safe to just
 unlink() the file?

 thanks in advance.

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



 According to http://docs.php.net/manual/en/wrappers.php.php, it looks
 like you should be using ...

 $filename = 'php://temp';

 That's it.

 The actual file name is not your job.



 --
 -
 Richard Quadling
 Standing on the shoulders of some very clever giants!
 EE : http://www.experts-exchange.com/M_248814.html
 EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 ZOPA : http://uk.zopa.com/member/RQuadling


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



[PHP] SOAP connect error

2010-02-09 Thread Eric Lommatsch
Hello,
 
I am working with the SOAP package of PHP and I am trying make a connection
from a hosted website to a server in our office. 
 
I can get to the server perfectly fine from within our office, but I cannot
connect from the eternal site.
 
I have checked and I am certain that the firewall for the server is open.
When I attempt to use the login page that I have created for the website I am
getting the following error message:
 
Connect Error to XX.XX.XX.XXX:8080
 
Where XX.XX.XX.XXX mask the actual ip address of the server. I have tried to
interogate all the values that soap_fault documents that it can return and
the only information I have been able to find beside the above message, which
is the $errorstring, is that my $faultcode = HTTP.
 
The information that I am getting is very cryptic. if I include our ip
address when I search I get no results. If I put in connect error :8080 I get
millions of meaningless results.
 
Can someone please help to figure out how to get more meaningful information
from soap_fault for this problem so that I can figure out how to fix it.
 
Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939 Ext 23
Fax 888-282-9927
 
er...@360b.com
 


[PHP] Re: SOAP connect error

2010-02-09 Thread Shawn McKenzie
Eric Lommatsch wrote:
 Hello,
  
 I am working with the SOAP package of PHP and I am trying make a connection
 from a hosted website to a server in our office. 
  
 I can get to the server perfectly fine from within our office, but I cannot
 connect from the eternal site.
  
 I have checked and I am certain that the firewall for the server is open.
 When I attempt to use the login page that I have created for the website I am
 getting the following error message:
  
 Connect Error to XX.XX.XX.XXX:8080
  
 Where XX.XX.XX.XXX mask the actual ip address of the server. I have tried to
 interogate all the values that soap_fault documents that it can return and
 the only information I have been able to find beside the above message, which
 is the $errorstring, is that my $faultcode = HTTP.
  
 The information that I am getting is very cryptic. if I include our ip
 address when I search I get no results. If I put in connect error :8080 I get
 millions of meaningless results.
  
 Can someone please help to figure out how to get more meaningful information
 from soap_fault for this problem so that I can figure out how to fix it.
  
 Thank you
  
 Eric H. Lommatsch
 Programmer
 360 Business 
 2087 South Grant Street
 Denver, CO 80210
 Tel 303-777-8939 Ext 23
 Fax 888-282-9927
  
 er...@360b.com
  
 

If you go home or to Starbucks can you get to http://XX.XX.XX.XXX:8080 ?
 If not, then the external server can't either.  It could be a network
firewall/proxy sever in your office, or any number of things.

-- 
Thanks!
-Shawn
http://www.spidean.com

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



[PHP] RE: SOAP connect error

2010-02-09 Thread Eric Lommatsch
-Original Message-
From: Shawn McKenzie [mailto:nos...@mckenzies.net] 
Sent: Tuesday, February 09, 2010 3:07 PM
To: Eric Lommatsch
Cc: php-general@lists.php.net
Subject: Re: SOAP connect error

Eric Lommatsch wrote:
 Hello,
  
 I am working with the SOAP package of PHP and I am trying make a 
 connection from a hosted website to a server in our office.
  
 I can get to the server perfectly fine from within our office, but I 
 cannot connect from the eternal site.
  
 I have checked and I am certain that the firewall for the server is open.
 When I attempt to use the login page that I have created for the 
 website I am getting the following error message:
  
 Connect Error to XX.XX.XX.XXX:8080
  
 Where XX.XX.XX.XXX mask the actual ip address of the server. I have 
 tried to interogate all the values that soap_fault documents that it 
 can return and the only information I have been able to find beside 
 the above message, which is the $errorstring, is that my $faultcode =
HTTP.
  
 The information that I am getting is very cryptic. if I include our ip 
 address when I search I get no results. If I put in connect error 
 :8080 I get millions of meaningless results.
  
 Can someone please help to figure out how to get more meaningful 
 information from soap_fault for this problem so that I can figure out how
to fix it.
  
 Thank you
  
 Eric H. Lommatsch
 Programmer
 360 Business
 2087 South Grant Street
 Denver, CO 80210
 Tel 303-777-8939 Ext 23
 Fax 888-282-9927
  
 er...@360b.com
  
 

If you go home or to Starbucks can you get to http://XX.XX.XX.XXX:8080 ?
 If not, then the external server can't either.  It could be a network
firewall/proxy sever in your office, or any number of things.

--
Thanks!
-Shawn
http://www.spidean.com


I have connected to a clients computer that is remote from our office and I
am able to get to http://XX.XX.XX.XXX:8080. I probably should have mentioned
that when I try to get the webservice outside of the PHP site I am developing
I can get into that just fine. It is just when I try to use the PHP SOAP
client to access the webservice that I am getting the issue.


Thank you
 
Eric H. Lommatsch
Programmer
360 Business 
2087 South Grant Street
Denver, CO 80210
Tel 303-777-8939 Ext 23
Fax 888-282-9927
 
er...@360b.com

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread clancy_1
On Tue, 9 Feb 2010 16:09:05 +, rquadl...@googlemail.com (Richard Quadling) 
wrote:

On 9 February 2010 14:20, Ashley Sheridan a...@ashleysheridan.co.uk wrote:

 On Tue, 2010-02-09 at 09:19 -0500, Robert Cummings wrote:

 Richard wrote:
  Hi,
 
  I have extended the standard exception class to send me an email
  whenever an exception occurs.
 
  I did that once. Once being the operative word... :-) Ended up with
  tens of thousands of emails one morning. At first I thought... Wow,
  maybe my popularity has grown somewhat. But it hadn't.

 I have something similar... a cron job that checks the error_log file
 every 10 minutes and sends me the contents if any exist. I also set a
 special header so I can be sure it's not spam and appropriately route it
 into my mail folder maze, Much less spammy :)

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


 Real developers don't have errors in their code; they're undocumented 
 features ;)

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



So, no documentation AND bugs!!! Gee. I really wouldn't want to rely
on that code base!

So you don't use (or work with) any Microsoft product?


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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Rene Veerman
Well, i've thought of a few ways to allow localized overriding of
values returned by functions in case of an error.

I have yet to figure out what the exact advantages are of this
code-standard, but the overhead seems acceptable and i recon this,
when done, will beat the trigger_error()-try-catch paradigm.
I'd like to hear your comments.

// imo unsafe  prone to fatalities:
$r = funcA ( funcB ( funcC ($p) ), funcD ($q) );

// safe; make all notices, warnings and errors from any level
// in the call-chain fully visible, identifiable, and survivable/fudgeable
// by code at (all) higher levels in the call-chain.
// [disclaimer] the code below here doesn't pass 3rd-level (funcC())
// (meta-)results back to the first level (funcA()) yet, but this code
// is a start towards that;
$r = funcA (defaults(array(0='[funcB failed]',1='funcD failed'))),
funcB (defaults($onError_cCallvalue),
funcC (defaults($onError_pValue), $p)
),
funcD (defaults($onError_qValue), $q)
);

function funcA ($defaults, $returnedByFuncB, $returnedByFuncD) {
$returnedByFuncB = workWith ($defaults, $returnedByFuncB, 0);
$returnedByFuncD = workWith ($defaults, $returnedByFuncD, 1);
//all parameters (with idx0) are meta-arrays containing the
parameter-value and all meta-info.
// workWith() always returns the actual parameter-value in 
$p['workValue'];

//if any parameter $p (with idx0) is not a meta-array,
//  workWith($d, $r, $n) turns it into a meta array(
//  'workValue' = $p
//  );

//if a param is a meta-array $p, and it contains an ['errors'] subarray,
//  workWith() sets by-reference $p['workValue'] to one of these
(order of trying):
//  $defaults['onError'][$n] (localized override)
//  $p['onErrorDefault'], (functions own default value for 
when an
error occurs)

//first call to workWith(,,0) will call beginErrorContext()

//beginErrorContext() will increase a global idx $callID (int),
//  used to list all notices, warnings and errors, and their details in
//  the global variable $callsErrors[$callID][$errorIdx++] = array(
//  'errorMsg' = 'for coders'
//  (optional:)'userErrorMsg' = 'for laymen'
//  'backtrace' = array()
//  )

// the never-fatal error handler specified with set_error_handler() will
//  call getDebugInfo() and append full error info into
//  $callsErrors[$callID][$errorIdx++]





//forwardDefaults() clones all meta-details for
//  re-used parameters into a new $defaults array to be used
//  by funcE().
//the 2nd parameter for forwardDefaults lists which parameter
//  passed deeper refers to which parameter received by this here 
function.
//the 3rd parameter for forwardDefaults is used to specify new defaults.
$returnedByFuncF = funcF('blablasetting');
$x = funcE (
forwardDefaults($defaults, array(0=0,2=1), array(1 = 
'defaultblabla')),
$returnedByFuncB, $returnedByFuncF, $returnedByFuncD
);
return goodResult($x);
}

function funcE ($defaults, $returnedByFuncB, $returnedByFuncF,
$returnedByFuncD) {
$returnedByFuncB = workWith ($defaults, $returnedByFuncB, 0);
$returnedByFuncF = workWith ($defaults, $returnedByFuncF, 2);
$returnedByFuncD = workWith ($defaults, $returnedByFuncD, 2);

// do a call that might raise E_WARNINGS or other crap;
// safeCall() is only a try-except struct to call in this case
// str_replace('xx','yy', ...) and if it fails,
// return the default instead of the actual result.
$x = safeCall (
defaults('returnedByFuncB not a string'),
'str_replace', 'xx','yy',$returnedByFuncB
);


if (is_string($returnedByFuncB)  is_string($returnedByFuncD)) {
return goodResult (
$returnedByFuncB . $returnedByFuncD . $x
);
// goodResult() and badResult() will both call
//  endErrorContext(), and copy the errors in
//  $callsErrors[$callID]
// to the array returned to the calling function.

// goodResult() and badResult() will call processErrors(),
//  which is repsonsible for mailing / db-storage of any
//  notices, warnings, errors, etc.

} else {
//  badResult() will call getDebugInfo() to include
//  a full trace, superglobals, lotsa details.
return badResult (array(
'errorMsg' = 'params 1 and 2 must be strings'
'onErrorDefault' = ''
));

Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Paul M Foster
On Tue, Feb 09, 2010 at 11:38:42PM +0100, Rene Veerman wrote:

 Well, i've thought of a few ways to allow localized overriding of
 values returned by functions in case of an error.
 
 I have yet to figure out what the exact advantages are of this
 code-standard, but the overhead seems acceptable and i recon this,
 when done, will beat the trigger_error()-try-catch paradigm.
 I'd like to hear your comments.
 
 // imo unsafe  prone to fatalities:
 $r = funcA ( funcB ( funcC ($p) ), funcD ($q) );

I wasn't going to comment, but seriously, Rene, I would not make it a
habit of calling functions within the parameters of other functions.
Among other things, it obviously creates a whole host of the problems
you're talking about, and it makes your code hard to debug and read. The
only way I'd normally do something like this is if I were using native
PHP functions and the possible failure of the functions wouldn't matter.
Rather, I'd do something like this:

$d = funcD($q);
// tests if necessary
$c = funcC($p);
// tests if necessary
$b = funcB($c);
// tests if necessary
$r = funcA($b, $d);

Paul

-- 
Paul M. Foster

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



Re: [PHP] PHP Manual problems

2010-02-09 Thread clancy_1
On Thu, 04 Feb 2010 02:39:03 +0100, joc...@iamjochem.com (Jochem Maas) wrote:

Op 2/4/10 1:32 AM, clanc...@cybec.com.au schreef:
 Recently I have frequently found, especially in the morning (GMT 2200 - 
 0200), that I can
 open a bookmark in the manual, for example 
 http://www.php.net/manual/en/ref.image.php.
 But if I then do a search of any type I get 'The page cannot be displayed'.  
 I then cannot
 reach any page, including the one I originally opened.
 
 This morning, after some fiddling, I found that if I closed the browser, and 
 re-opened it
 I could then see the original bookmark again, and link to some pages, but 
 others would
 again crash the browser, as would all searches.
 
 I am using IE6, and have seen a message that I should update my browser, but 
 only when the
 page is displaying properly.  Firefox 3.5.5 immediately converted the above 
 to
 http://au2.php.net/manual/en/ref.image.php. and then told me The manual 
 page you are
 looking for (http://au2.php.net/manual/en/ref.image.php.) is not available 
 on this server
 right now.

there are stacks of mirrors. try one of:

au.php.net
tw.php.net
tw2.php.net
tn.php.net
tn2.php.net
sg.php.net
sg2.php.net

... guessing those are closest to you.

Thanks. I was under the misapprehension that the providers server would 
automatically hunt
for a valid mirror, but I find that my various bookmarks are scattered on 
mirrors all over
the place. Also that if I do a search from what appears to be the logical 
starting
bookmark it doesn't work, but if I do it from most of the others it does. Very 
strange.

as for using IE6 ... WTF ... you do realise this is essentially a web 
developers mailing list right?

The interesting things in my websites go on behind-the-scenes, in the PHP, and 
produce
relatively straightforward HTML. I have avoided the well-known bugs in IE6, and 
think my
webpages display correctly on any of the modern browsers, but as Microsoft 
delights in
rearranging everything in every update, and making the features you need ever 
harder to
find, I stick to IE6 for my everyday work.


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



[PHP] Owner or other; permissions for webpage users

2010-02-09 Thread clancy_1
I'm basically familiar with the UNIX permissions - 'owner', 'group', or 
'other', but I
have no real idea how these apply to webpage users under PHP. I know that if I 
FTP to the
server I am the owner, and I think that if I, or anyone else, opens one of my 
webpages I
am 'other'.

However what I would like to do is assign certain users, who have logged in 
through a
security portal, to 'group', so that they (but not 'others') have permission to 
write to
data files on the site.

Can this be done with PHP?

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



Re: [PHP] PHP Manual problems

2010-02-09 Thread James McLean
On Wed, Feb 10, 2010 at 2:26 PM,  clanc...@cybec.com.au wrote:
 On Thu, 04 Feb 2010 02:39:03 +0100, joc...@iamjochem.com (Jochem Maas) wrote:
as for using IE6 ... WTF ... you do realise this is essentially a web 
developers mailing list right?

 The interesting things in my websites go on behind-the-scenes, in the PHP, 
 and produce
 relatively straightforward HTML. I have avoided the well-known bugs in IE6, 
 and think my
 webpages display correctly on any of the modern browsers, but as Microsoft 
 delights in
 rearranging everything in every update, and making the features you need ever 
 harder to
 find, I stick to IE6 for my everyday work.

Wow. Ignoring the issue that IE6 will soon be EOL (finally), and
ignoring how bad it is at handling anything even remotely modern, your
workstation must be a haven for virii, spyware and malware... IE6 has
just about the worst security track record out there, at least on the
desktop anyway.

If you must have IE6 for whatever reason, stick it on Windows
installed on a VM and upgrade your main workstation browser to
something more recent. At least a VM can be backed up at a known-good
point and if^H^Hwhen it gets compromised it can be deleted easily and
replaced with your backup.

I'll make it easy for you: http://www.getfirefox.com :)

Cheers

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



Re: [PHP] Owner or other; permissions for webpage users

2010-02-09 Thread James McLean
On Wed, Feb 10, 2010 at 2:51 PM,  clanc...@cybec.com.au wrote:
 I'm basically familiar with the UNIX permissions - 'owner', 'group', or 
 'other', but I
 have no real idea how these apply to webpage users under PHP. I know that if 
 I FTP to the
 server I am the owner, and I think that if I, or anyone else, opens one of my 
 webpages I
 am 'other'.

Almost right. It's UGO, User Group and Other.

When you view a PHP page, it's (usually) served by Apache, the process
will be owned by a user, usually 'apache'; who is also a member of a
group, usually 'apache'. On some systems these users/groups can be
'httpd', 'www-data' etc. When you or I look at a PHP file served from
Apache, there is no concept of users/groups/others outside those that
apply to the Apache process that served the data.

 However what I would like to do is assign certain users, who have logged in 
 through a
 security portal, to 'group', so that they (but not 'others') have permission 
 to write to
 data files on the site.

It's a seperate thing, because once again inside PHP there is no
concept of users/groups outside the Apache process itself. It would be
up to your PHP code to manage who has access to what, the files will
all be read from and written to disk by the Apache process.

HTH.

Cheers

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



Re: [PHP] Re: poll: howto do informative error handling without the fatalities

2010-02-09 Thread Rene Veerman
On Wed, Feb 10, 2010 at 3:04 AM, Paul M Foster pa...@quillandmouse.com wrote:
 $d = funcD($q);
 // tests if necessary
 $c = funcC($p);
 // tests if necessary
 $b = funcB($c);
 // tests if necessary
 $r = funcA($b, $d);


You're right.
I knew when i was posting my last reply yesterday that i had made
things probably too complicated.

But after sleeping and a look at real code which is to work with my
improved-err-handling, i've come up with a new construct, that i think
will fit the bill for now.

I'm going to use the result meta-array instead of plain result
values, because that
- completely equalizes the syntax for detecting bad results, and
prevents doing a lookup with a function to a value that is also the
bad-result return value for the lookup function.
- is much easier to read, than checking what the bad-result value is
for a lookup function.
- allows me to redirect the error info from a called function inside
the calling function
- allows infinite expansion of (meta-)communication between calling
and called functions.

So while i'm dumping the funcA (defaults($onError_pValue), $p) crap,
i'm retaining most of the other ideas in my previous post to this
thread.

the calling function does this, inside 3x foreach:

// if not done yet, resolve the fields 
for this table=hit that
require looking-up
if 
(!$sqls[$tableName]['hasPreInserts']) {
foreach 
($tableCmd['preInsertFields'] as $fieldName=$fieldLookupCmd) {
$r = 
maintenance__lookupPreInserts ($wm, $fieldLookupCmd);
if (!good($r)) {

$tableCmd['invalidPreInserts'] = true;
} else {

$sqls[$tableName]['preInserts'][$fieldName] = result($r);
}
}
}

if 
(!array_key_exists('invalidPreInserts', $tableCmd)) {
// add the fields for this table for 
this hit:
.


and the helper functions:

function maintenance__lookupPreInserts ($wm, $fieldLookupCmd) {
  startErrorContext(); // to catch php E_NOTICE, E_WARNING, etc
$flcp = explode ('::', $fieldLookupCmd);
if (count($flcp)!=3) {
return badResult(E_USER_ERROR, array(
'msg' = 'Need 3 counts of \'::\'',
'vars' = array (0=array('$fieldLookupCmd', 
$fieldLookupCmd))
));
  } 

$section = $flcp[0];

$searchInSection = array();
$criteria = explode (',,', $flcp[1]);
foreach ($criteria as $idx1 = $criterium) {
$cs = explode('===',$flcp[1]);
if (count($cs)!=2) return badResult (E_USER_ERROR, array(
'msg' =
'Any criterium (after first ::, 
between ,,) needs to be like
this:'.\n.
'fieldName===searchValue',
'vars' = array (0=array('$fieldLookupCmd', 
$fieldLookupCmd))
));
$searchInSection = array_merge ($searchInSection, array(
$cs[0] = $cs[1]
));
}

$pathInSection = explode(',,', $flcp[2]);

  foreach ($wm[$section] as $idx = $fields) {
$gotIt = true;
foreach ($searchInSection as $fn = $fv) {
  if ($fields[$fn]!=$fv) {
$gotIt = false;
break;
  }
}
if ($gotIt) {
  return chase ($wm[$section], $pathInSection);
}
  }
}


function chase ($arr, $indexes) {
  startErrorContext();
  $r = $arr;
  foreach ($indexes as $idx) {
if (is_array($r)) {
  $r = $r[$idx];
} else {
return badResult (E_USER_ERROR, array(
'msg' = 'Could not walk the full tree',
'vars' = array(
0=array('$arr', $arr),
1=array('$indexes', $indexes)
)
));
}
  }
  return goodResult($r);
}

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



Re: [PHP] PHP Manual problems

2010-02-09 Thread Lester Caine

James McLean wrote:

On Wed, Feb 10, 2010 at 2:26 PM,  clanc...@cybec.com.au wrote:

On Thu, 04 Feb 2010 02:39:03 +0100, joc...@iamjochem.com (Jochem Maas) wrote:

as for using IE6 ... WTF ... you do realise this is essentially a web 
developers mailing list right?

The interesting things in my websites go on behind-the-scenes, in the PHP, and 
produce
relatively straightforward HTML. I have avoided the well-known bugs in IE6, and 
think my
webpages display correctly on any of the modern browsers, but as Microsoft 
delights in
rearranging everything in every update, and making the features you need ever 
harder to
find, I stick to IE6 for my everyday work.


Wow. Ignoring the issue that IE6 will soon be EOL (finally), and
ignoring how bad it is at handling anything even remotely modern, your
workstation must be a haven for virii, spyware and malware... IE6 has
just about the worst security track record out there, at least on the
desktop anyway.

If you must have IE6 for whatever reason, stick it on Windows
installed on a VM and upgrade your main workstation browser to
something more recent. At least a VM can be backed up at a known-good
point and if^H^Hwhen it gets compromised it can be deleted easily and
replaced with your backup.

I'll make it easy for you: http://www.getfirefox.com :)


Since a large section of our USER base is still tied to W2k and does not have 
access to install other software, the call for IE6 to die is STILL somewhat 
premature!
What is needed is someone to kick M$ to sort the mess out by at least allowing 
IE8 to install on W2k machines, rather than telling hundreds of councils they 
have to replace ALL their computers :(


The alternative is to convince M$ controlled councils that Firefox is OK and 
that using it will not invalidate their contracts - but then all the work 
currently being done to convert legacy setups to work with *IE7* would have to 
be scrapped and reworked on Firefox. Many of my customers have only just got 
funds to start an *IE7* roll out! Redoing all that work for IE8 is yet another 
problem for which money is not available.


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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