php-general Digest 9 Aug 2007 18:04:53 -0000 Issue 4952

Topics (messages 260499 through 260522):

I know this is not easy and I'm not stupid but...
        260499 by: Phil Curry
        260501 by: Stut
        260521 by: Stut

Re: get domain component from email
        260500 by: Stut

Re: ORM framework suggestion
        260502 by: Edward Kay

Special Bonus For Switching Over From SunRocket!
        260503 by: VoIPTelco.net

Re: Hidden include_path Fall Back?
        260504 by: imacat

Access parent property from child
        260505 by: Suprie
        260506 by: Edward Kay
        260507 by: Stut

Re: magic quotes
        260508 by: Bastien Koert
        260511 by: David Giragosian
        260514 by: Ford, Mike

HTTP methods, Web Browsers and REST
        260509 by: Nathan Nobbe

Segmentation fault on PHP CLI
        260510 by: Martin Marques
        260512 by: Stut
        260513 by: Martin Marques

Code Igniter for 'novices' ?
        260515 by: Steve Finkelstein
        260516 by: Nathan Nobbe

Exceptions
        260517 by: Peter Pan
        260518 by: Nathan Nobbe
        260519 by: Peter Pan

Re: ADODB Insert Question (Syntax)
        260520 by: Graham Anderson

Forwarding $_POST[]...
        260522 by: Tony Di Croce

Administrivia:

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

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

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


----------------------------------------------------------------------
--- Begin Message --- how can this be? This is not the first time I've run into a situation like this. What am I missing?

line 102        echo  ($userValues['afterDark']);             // outputs 1

line 103        if ( $userValues['afterDark'] == 0 ) {        // passes


Thanks.
-Phil

--- End Message ---
--- Begin Message ---
Phil Curry wrote:
how can this be? This is not the first time I've run into a situation like this. What am I missing?

line 102    echo  ($userValues['afterDark']);             // outputs 1

line 103    if ( $userValues['afterDark'] == 0 ) {        // passes

Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Please include the list when replying.

Phil Curry wrote:
Phil Curry wrote:
how can this be? This is not the first time I've run into a situation like this. What am I missing?
line 102    echo  ($userValues['afterDark']);             // outputs 1
line 103    if ( $userValues['afterDark'] == 0 ) {        // passes

Add a line at 102.5...

var_dump($userValues['afterDark']);

What type is that variable?

Don't have to do a dump, I know its a tinyint(1), not null, default 0

That would be the type in the database, not the type of that variable at that time.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Richard Lynch wrote:
On Wed, August 8, 2007 4:26 am, Stut wrote:
Completely agree. It's like banning someone from a pub based on the
clothes they were wearing the last time you saw them.

Yeah, one drunk abusive chick in a little black dress could get EVERY
gal in a little black dress banned.

That's pretty messed up.

:-)

Messed up? That would be a disaster. It could happen to hot pants too!

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Matt Arnilo S. Baluyos (Mailing Lists)
> [mailto:[EMAIL PROTECTED]
> Sent: 09 August 2007 00:35
> To: PHP-General
> Subject: [PHP] ORM framework suggestion
>
>
> Hello All,
>
> I'm thinking of using an ORM framework for a new project. From my
> research, I've found Propel and Doctrine (of course, there might be
> others).
>
> Would anyone suggest what ORM framework they're using right now? I am
> experienced with OOP and am just looking for a framework to speed
> things up.
>
> I can perhaps test-drive both frameworks above and see what works
> better for me but maybe there are users here who's have had experience
> with either one (or better, both).
>
> Regards,
> Matt
>

Have a look at Qcodo: http://www.qcodo.com

If you're not after a full framework, just use the code generator to build
your ORM. I've been using it for about a year now and found it excellent.

Edward

--- End Message ---
--- Begin Message ---
Hi,

I want to introduce you to a new phone service that I'm using. It's called 
VoIPTelCo and it transforms your high speed Internet connection into a regular 
phone line. It works just like your current telephone service except it's 40% - 
60% cheaper. You get features like Call Waiting, Caller ID Display, Voicemail, 
3-Way calling, Call Forwarding and many more for a fraction of what you're 
paying now. You can even keep your existing number if you decide to switch to 
their service.

With VoIPTelCo, I also save money on long distance calling. Unlike a regular 
phone line, VoIPTelCo is "portable", which means I can get phone service 
anywhere in the world. All I need is high speed Internet access. For example, I 
use my VoIPTelCo service when I travel and there are no long distance fees 
because these calls are considered "local". I save so much money just on this 
alone.

Right now, VoIPTelCo is offering a ONE MONTH FREE trial period to friends and 
families of their customers. There is no obligation and it is completely free. 
If you'd like to try them out, just click on the link below and you will 
receive a 30 days trial period, free of charge:

http://www.voiptelco.net

Hope you'll find this useful.

--- End Message ---
--- Begin Message ---
On Wed, 8 Aug 2007 23:56:34 -0500 (CDT)
"Richard Lynch" <[EMAIL PROTECTED]> wrote:
> The default of php.ini starts with '.' in the first place, I think, so
> unless you go out of your way to change it, you'll get '.' from a
> fresh install anyway.
> 
> I personally would not rely on the behaviour of the code unless you
> can find Documentation on http://php.net that says it will work this
> way.
> 
> It cannot be that hard to append/prepend '.:' yourself to the
> include_path...

    I agree with this.  Personally I do not like the idea of having "."
in the search path since I may get different files in different
directories.  And coders should not depend on undocumented features.  I
shall file a documentation bug onto bugs.php.net.

    Thank you for your kind help.

-- 
imacat ^_*'
[EMAIL PROTECTED]
PGP Key: http://www.imacat.idv.tw/me/pgpkey.asc

Tavern IMACAT's http://www.imacat.idv.tw/
Woman's Voice http://www.wov.idv.tw/
TLUG List Manager http://www.linux.org.tw/mailman/listinfo/tlug

Attachment: pgp3GL4YYHBoW.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
dear all ...

i have question, i've tried look at google but still can't figured out
how to do it...
i want access parent property from child object the code was like

<?

class DAO
{
    private $db;
    private $id;

    protected function getId()
    {
        return $this->id;
    }
    protected function setId($id)
    {
        $this->id   = $id;
    }

    function getDB()
    {
        return $this->$db;
    }
    function setDB($db)
    {
        $this->db   = $db;
    }

    public function load($id)
    {
        $query  = "SELECT * FROM ".
                            constant(get_class($this)."::tableName").
                            " WHERE ".
                            constant(get_class($this)."::pkFields").
                            "='".$id."'";
        $rs     = $this->db->Execute($query);
        $cObj   = $rs->FetchObject(true);

        return $cObj;
    }

    public function save($rowData)
    {
        $this->db->debug = true;
        $query      ="Select * FROM
".constant(get_class($this)."::tableName")."\n";
        $res        =$this->db->Execute($query);
        $insertSQL  = $this->db->GetInsertSQL($res,$rowData);
        $res        =$this->db->Execute($insertSQL);
        if($res)
            return true;

        return false;
    }

    public function update($row, $id)
    {
        $query      =   "SELECT * FROM
".constant(get_class($this)."::tableName")."\n"
                    .   "WHERE
".constant(get_class($this)."::pkFields")."='".$id."'";
        $res        = $this->db->Execute($query);
        $updateSQL  = $this->db->GetUpdateSQL($res,$row);
        $db->Execute($updateSQL);
    }

    public function getAll($criteria='', $order='')
    {
        if(empty($order))
            $order  = constant(get_class($this)."::pkFields");

        $query      = "SELECT * FROM
".constant(get_class($this)."::tableName")."\n"
                    . $criteria
                    . "ORDER BY ".$order;
        $row        =   $this->db->Execute($query);
        if(!$row)
        {
            $this->error    = $this->db->ErrorMsg();
            return      false;
        }
        return $row->getArray();
    }

}

and i have this child
<?php

include 'BaseDAO.class.php';
class TaskCLDAO extends DAO
{
    const tableName = 'task';
    const pkFields  = 'task_id';

    function findWithRelation($id)
    {
          $query = "select * from task LEFT JOIN log ON task.id=log.task_id";
          $db      =  parent::getDB();
          $res     =  $db->Execute($query);
          return $res->getArray();
    }
}


?>

and this is the class that called it

<?php

$obj   = new TaskCLDAO();
$obj->setDB($db); //  i have another file called config that initialized the db;
$res   = $obj->findWithRelation(1);

?>

but the php's said

Fatal error: Cannot access empty property...

what does it mean ?? is there another way to access "$db" that parent have ?

TIA
-- 
Jangan tanyakan apa yang Indonesia telah berikan pada mu
tapi bertanyalah apa yang telah engkau berikan kepada Indonesia

-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GU/IT  d- s: a-- C++ UL P L++ E W++ N* o-- K-
w PS  Y-- PGP- t++ 5 X R++ tv  b+ DI D+ G e+ h* r- z?
 ------END GEEK CODE BLOCK------

--- End Message ---
--- Begin Message ---

> -----Original Message-----
> From: Suprie [mailto:[EMAIL PROTECTED]
> Sent: 09 August 2007 11:13
> To: [EMAIL PROTECTED]
> Subject: [PHP] Access parent property from child
>
>
> dear all ...
>
> i have question, i've tried look at google but still can't figured out
> how to do it...
> i want access parent property from child object the code was like
>
> <?
>
> class DAO
> {
>     private $db;
>     private $id;
>
>     protected function getId()
>     {
>         return $this->id;
>     }
>     protected function setId($id)
>     {
>         $this->id   = $id;
>     }
>
>     function getDB()
>     {
>         return $this->$db;
>     }
>     function setDB($db)
>     {
>         $this->db   = $db;
>     }
>
>     public function load($id)
>     {
>         $query  = "SELECT * FROM ".
>                             constant(get_class($this)."::tableName").
>                             " WHERE ".
>                             constant(get_class($this)."::pkFields").
>                             "='".$id."'";
>         $rs     = $this->db->Execute($query);
>         $cObj   = $rs->FetchObject(true);
>
>         return $cObj;
>     }
>
>     public function save($rowData)
>     {
>         $this->db->debug = true;
>         $query      ="Select * FROM
> ".constant(get_class($this)."::tableName")."\n";
>         $res        =$this->db->Execute($query);
>         $insertSQL  = $this->db->GetInsertSQL($res,$rowData);
>         $res        =$this->db->Execute($insertSQL);
>         if($res)
>             return true;
>
>         return false;
>     }
>
>     public function update($row, $id)
>     {
>         $query      =   "SELECT * FROM
> ".constant(get_class($this)."::tableName")."\n"
>                     .   "WHERE
> ".constant(get_class($this)."::pkFields")."='".$id."'";
>         $res        = $this->db->Execute($query);
>         $updateSQL  = $this->db->GetUpdateSQL($res,$row);
>         $db->Execute($updateSQL);
>     }
>
>     public function getAll($criteria='', $order='')
>     {
>         if(empty($order))
>             $order  = constant(get_class($this)."::pkFields");
>
>         $query      = "SELECT * FROM
> ".constant(get_class($this)."::tableName")."\n"
>                     . $criteria
>                     . "ORDER BY ".$order;
>         $row        =   $this->db->Execute($query);
>         if(!$row)
>         {
>             $this->error    = $this->db->ErrorMsg();
>             return      false;
>         }
>         return $row->getArray();
>     }
>
> }
>
> and i have this child
> <?php
>
> include 'BaseDAO.class.php';
> class TaskCLDAO extends DAO
> {
>     const tableName = 'task';
>     const pkFields  = 'task_id';
>
>     function findWithRelation($id)
>     {
>           $query = "select * from task LEFT JOIN log ON
> task.id=log.task_id";
>           $db      =  parent::getDB();
>           $res     =  $db->Execute($query);
>           return $res->getArray();
>     }
> }
>
>
> ?>
>
> and this is the class that called it
>
> <?php
>
> $obj   = new TaskCLDAO();
> $obj->setDB($db); //  i have another file called config that
> initialized the db;
> $res   = $obj->findWithRelation(1);
>
> ?>
>
> but the php's said
>
> Fatal error: Cannot access empty property...
>
> what does it mean ?? is there another way to access "$db" that
> parent have ?
>
> TIA


In function getDb()

  return $this->$db;

should be:

  return $this->db;

Also, although not strictly required, I suggest you add the public keyword
to your methods that don't specifiy their visibility.

Edward

--- End Message ---
--- Begin Message ---
Suprie wrote:
    function getDB()
    {
        return $this->$db;
    }

There should not be a $ before db. It should be $this->db. That's why PHP is telling you the property is empty... because it is.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
you could use ini_set at the top of the script to turn the magic quotes 
off...if you add this in a prepend file or a common included file that sits at 
the top of the script, it should take care of the damn magic quotes...
 
failing that ask your host to turn it off
 
Bastien> From: [EMAIL PROTECTED]> To: [EMAIL PROTECTED]> CC: [EMAIL PROTECTED]> 
Date: Wed, 8 Aug 2007 23:58:50 -0500> Subject: RE: [PHP] magic quotes> > I 
added the code to my script and I still ended up escaped quotes.> 
if(ini_get('magic_quotes_gpc')) $_POST['data'] => stripslashes($_POST['data']); 
Didn't work at all. I think I read something> about it not working on runtime 
data. Like gpc if this is correct do you> have another solution? I put this 
line in the .htaccess file it didn't work> either: php_flag magic_quotes_gpc 
off... Is there anyway possible? I don't> need it now but it'd be nice to know 
for the future dev.> > Kevon K. Hayes> 815-980-3435> RFD, IL> > -----Original 
Message-----> From: Richard Lynch [mailto:[EMAIL PROTECTED] > Sent: Wednesday, 
August 08, 2007 11:49 PM> To: k3cheese> Cc: [EMAIL PROTECTED]> Subject: RE: 
[PHP] magic quotes> > .htaccess is only meaningful for Apache.> > JavaScript is 
equally useless to Ajax for working around Magic Quotes.> > On Wed, August 8, 
2007 7:55 am, k3cheese wrote:> > Thanks,> >> > Met javascript not ajax. I had 
AJAX on the brain do to a project I'm> > working> > on. So I'm assuming there 
is a library of functions to use with the> > .htaccess file? Cause it looks 
like you can use UNIX and PHP to edit> > this> > file?> >> > Kevon K. Hayes> > 
815-980-3435> > RFD, IL> >> > -----Original Message-----> > From: Richard Lynch 
[mailto:[EMAIL PROTECTED]> > Sent: Tuesday, August 07, 2007 11:30 PM> > To: 
KVIGOR> > Cc: [EMAIL PROTECTED]> > Subject: Re: [PHP] magic quotes> >> > On 
Tue, July 31, 2007 9:28 am, KVIGOR wrote:> >> If magic quotes is on and I dont 
have access to the php.ini.> >>> >> Is there any way I can strip quotes from 
the form field with out> >> using> >> AJAX?> >> > Best: Use .htaccess to turn 
magic_quotes off.> > Okay: Use something like if (ini_get('magic_quotes_gpc')) 
$data => > stripslashes($data);> > Worst: Ajax cannot possibly begin to address 
this issue and is> > completely useless to solve this particular problem.> >> > 
--> > Some people have a "gift" link here.> > Know what I want?> > I want you 
to buy a CD from some indie artist.> > http://cdbaby.com/browse/from/lynch> > 
Yeah, I get a buck. So?> >> > No virus found in this incoming message.> > 
Checked by AVG Free Edition.> > Version: 7.5.476 / Virus Database: 269.11.6/938 
- Release Date:> > 8/5/2007> > 4:16 PM> >> >> > No virus found in this outgoing 
message.> > Checked by AVG Free Edition.> > Version: 7.5.476 / Virus Database: 
269.11.6/938 - Release Date:> > 8/5/2007> > 4:16 PM> >> >> > > -- > Some people 
have a "gift" link here.> Know what I want?> I want you to buy a CD from some 
indie artist.> http://cdbaby.com/browse/from/lynch> Yeah, I get a buck. So?> > 
No virus found in this incoming message.> Checked by AVG Free Edition. > 
Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007> 4:06 
PM> > > No virus found in this outgoing message.> Checked by AVG Free Edition. 
> Version: 7.5.476 / Virus Database: 269.11.8/941 - Release Date: 8/7/2007> 
4:06 PM> > > -- > PHP General Mailing List (http://www.php.net/)> To 
unsubscribe, visit: http://www.php.net/unsub.php> 
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us

--- End Message ---
--- Begin Message ---
On 8/9/07, Bastien Koert <[EMAIL PROTECTED]> wrote:
>
>
> you could use ini_set at the top of the script to turn the magic quotes
> off...if you add this in a prepend file or a common included file that sits
> at the top of the script, it should take care of the damn magic quotes...


Why might this not work? I tried using ini_set(magic_quotes_gpc, 0 | "0" |
FALSE | "FALSE" ) and none of these worked either locally on my dev system
or on a hosting system I just started using. PHP versions were either 5.2.0or
5.2.1.

failing that ask your host to turn it off


The guy graciously did turn it off when I asked him to.

Bastien


David

--- End Message ---
--- Begin Message ---
On 09 August 2007 14:44, David Giragosian wrote:

> On 8/9/07, Bastien Koert <[EMAIL PROTECTED]> wrote:
> > 
> > 
> > you could use ini_set at the top of the script to turn the magic
> > quotes off...if you add this in a prepend file or a common included
> > file that sits at the top of the script, it should take care of the
> > damn magic quotes... 
> 
> 
> Why might this not work?

Because, by the time your script starts executing, any magic_quotes_gpc 
processing has already been applied. As such, it only makes sense to set this 
option in php.ini, httpd.conf or .htaccess (or equivalents).

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
JG125, The Headingley Library,
James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 812 4730          Fax:  +44 113 812 3211 


To view the terms under which this email is distributed, please go to 
http://disclaimer.leedsmet.ac.uk/email.htm

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

some time ago i read about
REST<http://en.wikipedia.org/wiki/Representational_State_Transfer>
.
at first i thought for web services SOAP is much better for the self
describing feature of the WSDL.
then, reading through the Zend certification preparation book, there was a
section on using POST
vs. GET to request data from the server.  The section said in general to use
GET when information on
the server was not going to me altered.
So i have now started to set the method attribute of the form tag to get on
those forms that do not
modify data on the server.  Looking over PHP i can see a web service client
could be written for a
RESTful web service using the curl extension (and perhaps others as well)
because it facilitates an
ability to invoke the HTTP PUT and DELETE methods.
Now, coming to my question..  Looking at the W3C page on the XHTML 1.0 form
tag specification <http://www.w3schools.com/tags/tag_form.asp>, it is
clear the method attribute supports only  get and post.  What i wonder is
why would it not also support
put and delete?  im sure javascript could be used to invoke the put and
delete methods, but is there a way
to do this w/ XHTML ?
certainly it would be cleaner to map actions in an application to specific
http methods rather than have an
action variable or whatever on every page.  since the form tag supports get
and post, still on every page
that offers add / delete functionality an action (or similar) variable is
still necessary.

can someone speak to this ?

thanks,

-nathan

--- End Message ---
--- Begin Message --- I have a script which I run from cron. I'm testing it directly from the console:

/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it throughs a segmentation fault at the end.

Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server the cron runs without this problem.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' ||
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
Martin Marques wrote:
I have a script which I run from cron. I'm testing it directly from the console:

/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it throughs a segmentation fault at the end.

Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server the cron runs without this problem.

Is PHP on the production server the same old version? I would start by upgrading your development server to the latest version as you may be hitting a known bug that's already been fixed.

-Stut

--
http://stut.net/

--- End Message ---
--- Begin Message ---
Stut wrote:
Martin Marques wrote:
I have a script which I run from cron. I'm testing it directly from the console:

/usr/bin/php  -f /path/to/script.php

The thing is:

Script executes great, and everything it has to do gets done, but it throughs a segmentation fault at the end.

Is there anyway to debug PHP CLI? I'm using php5 from debian etch:

$ php -v
PHP 5.2.0-8+etch7 (cli) (built: Jul  2 2007 21:46:15)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2006 Zend Technologies

BTW: all this is on the development server. On the production server the cron runs without this problem.

Is PHP on the production server the same old version? I would start by upgrading your development server to the latest version as you may be hitting a known bug that's already been fixed.

Same version on both. The idea is to use the same version, so we don't end up with unhappy results when putting new stuff in production.


--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' ||
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
    del Litoral             |   Administrador
---------------------------------------------------------

--- End Message ---
--- Begin Message ---
Hi all,

This isn't a 'which framework is better than the other' question. I'm a
novice developer and I'm looking to conform to an MVC model for my
applications. I was wondering if anyone would be kind enough and has used
code igniter, to respond to me and let me know their thoughts on it, and if
it's a good framework to work with as a novice.

I eventually hope to learn the core values and build my own robust
framework.

Thanks :-)

--- End Message ---
--- Begin Message ---
steve,

though i havent used code igniter i consider the tutorials on the site
demonstrating how to use it quite valuable.
i think they are valuable because they can show people who arent familiar w/
a development flow,
using an mvc framework, what its like, in general.
i have heard good things about code igniter.

if you want to learn the core values, i recommend opp and design patterns.
here is a nice free site to get you headed in the right direction for php.

http://www.phppatterns.com/docs/start

-nathan

On 8/9/07, Steve Finkelstein <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> This isn't a 'which framework is better than the other' question. I'm a
> novice developer and I'm looking to conform to an MVC model for my
> applications. I was wondering if anyone would be kind enough and has used
> code igniter, to respond to me and let me know their thoughts on it, and
> if
> it's a good framework to work with as a novice.
>
> I eventually hope to learn the core values and build my own robust
> framework.
>
> Thanks :-)
>

--- End Message ---
--- Begin Message ---
Peeps,

I'm having an issue where throwing Exceptions are displaying a blank page even though the Exception is being caught in a try...catch statement. This is happening on our production server where warnings, errors, exceptions, etc. are not to be displayed to the user. The assumption is that even though an Exception is being thrown it should be caught rather than displaying a blank page. Is there a specific configuration variable that needs to be set in php.ini to allow warnings to not be displayed but Exceptions to still be caught? Or is this just a bug? Here is some code that replicates the issue:

try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
}

function closeCallTracker($appId, $salesRepId) {

  // Some code here...

// A pretty near example of why the Exception is being thrown in our system
  if ($callTrackerAlreadyClosed) {
throw new Exception('Can not close a call tracker that has already been closed.');
  }
}

I'm expecting the program to continue as normal as the Exception has been caught appropriately... but instead this code is displaying a blank page.

We're using PHP: 5.1.2 on SuSe

This is really a bizarre issue and any help would be greatly appreciated. I've searched PHP.net and Google far too long on this issue. Thank you in advance.

-ec

_________________________________________________________________
Learn.Laugh.Share. Reallivemoms is right place! http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
--- End Message ---
--- Begin Message ---
Peter,

you are doing something called swallowing the exception.  it may make sense
for your application to
continue processing if the closeCallTracker method throws an error, but at a
minimum you should
log the details of the exception so that you know why its occurring;
something like:

try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
   MyPHPLog::logMsg($e->getMessage());
}

also, i would assume processing does continue after you swallow the
exception.  in order to determine
why a blank page is displaying you should follow the logic in your
application to the point where it sends
html to the client browser during a case where the closeCallTracker() method
throws an error.

-nathan

On 8/9/07, Peter Pan <[EMAIL PROTECTED]> wrote:
>
> Peeps,
>
> I'm having an issue where throwing Exceptions are displaying a blank page
> even though the Exception is being caught in a try...catch
> statement.  This
> is happening on our production server where warnings, errors, exceptions,
> etc. are not to be displayed to the user.  The assumption is that even
> though an Exception is being thrown it should be caught rather than
> displaying a blank page.  Is there a specific configuration variable that
> needs to be set in php.ini to allow warnings to not be displayed but
> Exceptions to still be caught?  Or is this just a bug?  Here is some code
> that replicates the issue:
>
> try {
>     closeCallTracker($appId, $salesRepId);
> } catch (Exception $e) {
>     // No need to display anything to user if call tracker is not closed
> }
>
> function closeCallTracker($appId, $salesRepId) {
>
>    // Some code here...
>
>    // A pretty near example of why the Exception is being thrown in our
> system
>    if ($callTrackerAlreadyClosed) {
>       throw new Exception('Can not close a call tracker that has already
> been closed.');
>    }
> }
>
> I'm expecting the program to continue as normal as the Exception has been
> caught appropriately... but instead this code is displaying a blank page.
>
> We're using PHP: 5.1.2 on SuSe
>
> This is really a bizarre issue and any help would be greatly appreciated.
> I've searched PHP.net and Google far too long on this issue.  Thank you in
> advance.
>
> -ec
>
> _________________________________________________________________
> Learn.Laugh.Share. Reallivemoms is right place!
> http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Nathan,

I was hoping for a bug! I'll take a deeper look at the ini. More research is needed, me thinks.

It's become apparent that throwing an Exception for this particular case doesn't really make sense. I'll just return early rather than throwing an exception. The logging suggestion is a great idea, but not realistic given the amount of times this function is called.

Thank you for your help!  I'll update the list with my findings.

-ec

From: "Nathan Nobbe" <[EMAIL PROTECTED]>
To: "Peter Pan" <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: [PHP] Exceptions
Date: Thu, 9 Aug 2007 13:00:51 -0400

Peter,

you are doing something called swallowing the exception.  it may make sense
for your application to
continue processing if the closeCallTracker method throws an error, but at a
minimum you should
log the details of the exception so that you know why its occurring;
something like:

try {
   closeCallTracker($appId, $salesRepId);
} catch (Exception $e) {
   // No need to display anything to user if call tracker is not closed
   MyPHPLog::logMsg($e->getMessage());
}

also, i would assume processing does continue after you swallow the
exception.  in order to determine
why a blank page is displaying you should follow the logic in your
application to the point where it sends
html to the client browser during a case where the closeCallTracker() method
throws an error.

-nathan

On 8/9/07, Peter Pan <[EMAIL PROTECTED]> wrote:
>
> Peeps,
>
> I'm having an issue where throwing Exceptions are displaying a blank page
> even though the Exception is being caught in a try...catch
> statement.  This
> is happening on our production server where warnings, errors, exceptions,
> etc. are not to be displayed to the user.  The assumption is that even
> though an Exception is being thrown it should be caught rather than
> displaying a blank page. Is there a specific configuration variable that
> needs to be set in php.ini to allow warnings to not be displayed but
> Exceptions to still be caught? Or is this just a bug? Here is some code
> that replicates the issue:
>
> try {
>     closeCallTracker($appId, $salesRepId);
> } catch (Exception $e) {
>     // No need to display anything to user if call tracker is not closed
> }
>
> function closeCallTracker($appId, $salesRepId) {
>
>    // Some code here...
>
>    // A pretty near example of why the Exception is being thrown in our
> system
>    if ($callTrackerAlreadyClosed) {
>       throw new Exception('Can not close a call tracker that has already
> been closed.');
>    }
> }
>
> I'm expecting the program to continue as normal as the Exception has been > caught appropriately... but instead this code is displaying a blank page.
>
> We're using PHP: 5.1.2 on SuSe
>
> This is really a bizarre issue and any help would be greatly appreciated. > I've searched PHP.net and Google far too long on this issue. Thank you in
> advance.
>
> -ec
>
> _________________________________________________________________
> Learn.Laugh.Share. Reallivemoms is right place!
> http://www.reallivemoms.com?ocid=TXT_TAGHM&loc=us
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

_________________________________________________________________
Messenger Café — open for fun 24/7. Hot games, cool activities served daily. Visit now. http://cafemessenger.com?ocid=TXT_TAGHM_AugHMtagline
--- End Message ---
--- Begin Message ---
Wow.  I feel really dumb.
I thought (incorrectly) that the surrounding quotes would screw with the variables in the ADODB's INSERT statement.

many thanks
G

On Aug 7, 2007, at 2:06 PM, Uber Wannabe wrote:

-----Original Message-----
From: Graham Anderson [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 07, 2007 3:34 PM
To: php-general
Subject: [PHP] ADODB Insert Question (Syntax)

Hi

What is the proper way to get the ADODB class to automatically add
quotes to the below sql ?
I'm guessing that the below fails because none of the variables get
quoted with the method, qstr.

$sql = "insert into email (to_name, to_email, from_name, from_email,
subject, message, timestamp, ip) ";
$sql .= "values ($to_name, $to_email, $from_name, $from_email,
$subject, $message, $time, $ip)";


I tried something like the below to no avail
$sql .= "values($conn->qstr($to_name), $conn->qstr
($to_email), .......)";


Is there an accepted way to place multiple $variables inside an ADODB
insert statement?

many thanks

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

-----End Original Message-----


Okay, I'm probably missing something, but why can't the values portion just
say:

"values ('$to_name', '$to_email', '$from_name',... etc.

... with the single quotes around the variable names?


-- N/A




--- End Message ---
--- Begin Message ---
I keep wanting to do something, and either I dont know how to do it, or I'm
doing something wrong and need to rethink things.

Quite often, I have a form that submits to a php script via POST and after
doing some processing (or more frequently, asking the user a question), I'd
like to forward those $_POST[] vars to another script (or even the same
script).

I could do something complicated and store the $_POST vars in $_SESSION[],
but what I'd rather do is simply add a var to $_POST[] and resubmit this to
the same .php.

Is their any way to do this, or do I need to rethink things?

   td

-- 
Publish technical articles @ skilledwords.com and get 100% of the
ad-revenue!
http://www.skilledwords.com

--- End Message ---

Reply via email to