Re: [PHP] use strict or similar in PHP?

2009-02-26 Thread Lewis Wright
Yes you can use:

error_reporting(E_ALL);

Which will enable notices. You can even do:

error_reporting(E_ALL | E_STRICT);

To enable strict messages.

Lewis.

2009/2/26 Hans Schultz h.schult...@yahoo.com:
 Hello,
 I am beginner with PHP and prior to PHP I have worked with java for some
 time
 and with perl for very short period. I can't help to notice some things that
 are little annoyance for me with PHP, but I am sure someone more experienced
 can help me :-)
 Is there in PHP something like use strict from perl? I find it pretty
 annoying to need to run script over and over again just to find out that I
 made typo in variable name.
 Is there some way for PHP to cache some data on the page? I like very much
 PHP's speed but it would be even better to be able to cache some frequently
 used data from database?
 Also regarding databases, I liked a lot java's way of sending data to
 database
 using parameters (select * from user where username = ? and then passing
 parameter separately with database doing necessary escaping and everything).
 Is there something like PHPDBC similar to JDBC?

 TIA,
 Hans


 --
 Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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



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



Re: [PHP] help installing phpDocumentor

2009-02-24 Thread Lewis Wright
Forgot to click reply all! Sorry.

-- Forwarded message --
From: Lewis Wright lewiswri...@gmail.com
Date: 2009/2/24
Subject: Re: [PHP] help installing phpDocumentor
To: a...@ashleysheridan.co.uk


Turn on notices and maybe even strict messages (in your development
environment), and PHP should warn you of any deprecated code.

2009/2/24 Ashley Sheridan a...@ashleysheridan.co.uk:
 On Tue, 2009-02-24 at 08:51 -0500, Bob McConnell wrote:
 From: Jim Lucas
 
  I may be wrong, but I heard short tags were going the
   way of the Dodo bird as of PHP6.

 This is not surprising. With the advent of XHTML, the short tag option
 collides with another valid tag, ?xml. So that option has to be
 turned off as soon as you need any XML in your pages. I'm in the process
 of correcting that in more than 150 files in one project alone. There
 are two other bigger projects that require the same treatment. All three
 also make extensive use of magic quotes and register_globals, which are
 likewise becoming extinct.

 Which reminds me, where can I get a definitive list of all deprecated
 features? In addition to identifying each feature, it should indicate
 which release marked them deprecated, and which release will no longer
 support them, if known.

 Bob McConnell

 php.net is the best place to find details on what is deprecated, but
 afaik, it doesn't offer this in list form, but on each man page for a
 function, etc. you could download the offline documentation and do a
 search within all the files for the word 'deprecated'. ugly, but the
 best way i know of.


 Ash
 www.ashleysheridan.co.uk


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



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



Re: [PHP] help installing phpDocumentor

2009-02-24 Thread Lewis Wright
I'm sorry, Gmail makes me do it!

2009/2/24 Ashley Sheridan a...@ashleysheridan.co.uk:
 On Tue, 2009-02-24 at 20:18 +, Lewis Wright wrote:
 Forgot to click reply all! Sorry.

 -- Forwarded message --
 From: Lewis Wright lewiswri...@gmail.com
 Date: 2009/2/24
 Subject: Re: [PHP] help installing phpDocumentor
 To: a...@ashleysheridan.co.uk


 Turn on notices and maybe even strict messages (in your development
 environment), and PHP should warn you of any deprecated code.

 2009/2/24 Ashley Sheridan a...@ashleysheridan.co.uk:
  On Tue, 2009-02-24 at 08:51 -0500, Bob McConnell wrote:
  From: Jim Lucas
  
   I may be wrong, but I heard short tags were going the
    way of the Dodo bird as of PHP6.
 
  This is not surprising. With the advent of XHTML, the short tag option
  collides with another valid tag, ?xml. So that option has to be
  turned off as soon as you need any XML in your pages. I'm in the process
  of correcting that in more than 150 files in one project alone. There
  are two other bigger projects that require the same treatment. All three
  also make extensive use of magic quotes and register_globals, which are
  likewise becoming extinct.
 
  Which reminds me, where can I get a definitive list of all deprecated
  features? In addition to identifying each feature, it should indicate
  which release marked them deprecated, and which release will no longer
  support them, if known.
 
  Bob McConnell
 
  php.net is the best place to find details on what is deprecated, but
  afaik, it doesn't offer this in list form, but on each man page for a
  function, etc. you could download the offline documentation and do a
  search within all the files for the word 'deprecated'. ugly, but the
  best way i know of.
 
 
  Ash
  www.ashleysheridan.co.uk
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 

 And top posting too - special kinds of programmers hell have been
 reserved for less! ;)


 Ash
 www.ashleysheridan.co.uk



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



Re: [PHP] help installing phpDocumentor

2009-02-24 Thread Lewis Wright
2009/2/24 Bob McConnell r...@cbord.com:
 From: Lewis Wright

 Turn on notices and maybe even strict messages (in your development
 environment), and PHP should warn you of any deprecated code.

 Easier said than done. I don't have an IDE available. I have tried the
 Komodo editor and am now playing with Eclipse/PDT, but neither of those
 comes with a local interpreter.

 My workstation is Win-XPPro and the development/test server is Apache
 2.0.55 running on a RHEL 5 VM in an ESX server farm. Each project gets a
 set of virtual domains and matching directories. There is also a unique
 base directory for each code release, so I don't even know if I can
 figure out how to map a debugger into that environment.

 Currently I use WinSCP to copy files to my home directory and log in
 with Putty to move them to the target directory. But it is running PHP
 5.2.3, which I don't think will tell me much about the newer releases.

 I have asked, but we don't have a process in place to update that.
 Sometime in the _near_ future I have to investigate whether there are
 security fixes since then that we should get.

 Bob McConnell

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



Well you don't have to have a test server in your IDE. In your on
Windows, try searching for WAMPserver. As for turning on errors, how
about:

if ($_SERVER['HTTP_HOST'] == '127.0.0.1'){
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', true);
}

Of course, if you're not running a test server on localhost, then
change 127.0.0.1 to your IP address.

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



Re: [PHP] php cli memory leak error

2009-02-19 Thread Lewis Wright
2009/2/19 Jochem Maas joc...@iamjochem.com:
 Thodoris schreef:


 seems to work fine here.

 What are your php.ini (memory related) settings?

 run:

 /usr/local/bin/php --ini

 and get the location of the php.ini file that is getting used.  Check
 our the memory settings in that file.





 Some general options:
 max_input_time = 60
 max_execution_time = 120
 memory_limit = 128M

 and the last one I have just noticed (that is why it reports the leak):

 report_memleaks = On

 In case I set this to Off it just stops bugging me. But is there a
 memory leak?

 yes.

 And if yes should I report this as a bug ?

 if (

1. report_memleaks is a core php.ini setting (not suhosin) (I don't 
 recall)
2. you still get the leak if you disable suhosin extension
3. you can create a small reproduction script (seems you have one, but 
 I'd
   check that it's the getopt() call that triggers the leak)
4. you can show the mem leak in 5.2.9RC2 and/or php5.3dev
 ) {
report_a_bug();
 }


Syntax error, unexpected T_STRING :(

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



Re: [PHP] Full versus relative URLs

2009-02-17 Thread Lewis Wright
But that's where mistakes are often made. It also means you need to
maintain a different live version to that of your development version.
If find it much easier to have relative paths and then there's no
build process needed to go live, I can just upload it.

2009/2/17 Michael A. Peters mpet...@mac.com:
 Virgilio Quilario wrote:

 The difference is in manageability.
 Copying the scripts to another domain and you're using full url for
 your src and href when referring to local images or css or pages, will
 give you trouble and you must change all of them to your new domain.

 which takes about 3 seconds to do with sed.

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



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



Re: [PHP] function array problem

2009-02-17 Thread Lewis Wright
What about:


function addEvent($values='')
{
!is_array($values)  $values = Array('name' = '', 'venue' = '',
'description' ='',
'errors' = Array());

 //rest of the code

}

It's nice and sort.

2009/2/17 Ashley Sheridan a...@ashleysheridan.co.uk:
 On Tue, 2009-02-17 at 15:21 -0500, Andrew Ballard wrote:
 On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan
 a...@ashleysheridan.co.uk wrote:
  On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote:
  On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan
  a...@ashleysheridan.co.ukwrote:
 
   I've had a bit of a problem with a function I'm using for a form.
   Essentially, the function looks like this:
  
   function addEvent($values = Array('name' = '', 'venue' = '',
   'description' = '', 'errors' = Array()))
   {
  // code here displays the form
   }
  
   The function is used to both display an empty form, and the form
   populated with values again should there be any validation errors.
  
   Now this works fine when the form has been filled out and there are
   errors present, as I can call the function with the correct array
   values. However, when I call the function with no arguments (intending
   the function to populate the $values array itself) all it does is
   present me with an empty array. A print_r($values) just returns
   Array( ), no key values defined.
  
   I altered the function to this:
  
   function addEvent($values = Array())
   {
  if(count($values) == 0)
  {
  $values = Array('name' = '', 'venue' = '', 'description' =
   '', 'errors' = Array());
  }
  // code here displays the form
   }
  
   then all works as intended. Question is, am I being dense, or is there a
   reason why this shouldn't work?
  
  
   Ash
   www.ashleysheridan.co.uk
  
  
   --
   PHP General Mailing List (http://www.php.net/)
   To unsubscribe, visit: http://www.php.net/unsub.php
  
  
 
  i tend to do
 
  function addEvent($values='')
  {
if (!is_array($values))
   {
 $values = Array('name' = '', 'venue' = '', 'description' ='',
  'errors' = Array());
   }
//rest of the code
 
  }
 
 
 
  It's a shame really, because to me it just seems darn messy to have to
  perform a check inside the function itself and initialise variables
  there. Putting such initialisations inside the parentheses seems more
  elegant. :(
 
 
  Ash
  www.ashleysheridan.co.uk

 To each their own. I think having an array (especially nested arrays)
 embedded in the parameter list of a function declaration like that
 looks kind of ugly, but that's just me.

 Andrew

 You kidding? Nested arrays is what makes me get up in the morning!


 Ash
 www.ashleysheridan.co.uk


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



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



Re: [PHP] Re: Reverse IP lookup

2009-02-16 Thread Lewis Wright
This may be a little more accurate:
http://www.domaintools.com/reverse-ip/

But I think you have to pay if you want to use it a lot.

2009/2/16 Jonesy gm...@jonz.net:
 On Mon, 16 Feb 2009 10:26:17 -0500, Robert Cummings wrote:
 On Mon, 2009-02-16 at 10:11 -0500, tedd wrote:
 At 9:17 PM -0500 2/15/09, Andrew Ballard wrote:
 You mean like this one?
 
 http://www.yougetsignal.com/tools/web-sites-on-web-server/
 
 I don't know how reliable or up-to-date it is.

 Now that's something I would like to know how it works.

 Anyone have any ideas as to how that works?

 It tells you how it's done.

 And, it does a poor job.  My web host's IP where numerous domains
 are VHOST'ed (including several of my domains)  - TAA DAA - _only_
 the web hosting server.domain.name.

 Jonesy
 --
  Marvin L Jones| jonz  | W3DHJ  | linux
   38.24N  104.55W  |  @ config.com | Jonesy |  OS/2
* Killfiling google  banter.com: jonz.net/ng.htm


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



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



Re: [PHP] Opinions Please, Describing PHP as Web Framework of C and C++

2009-02-16 Thread Lewis Wright
I'd personally say that PHP was originally intended to essentially be
a framework for the web, but has since evolved in to its own language.
It's just my opinion though...

2009/2/16 Thodoris t...@kinetix.gr:

 Hello list.

 Recently we had some serious discussion on local boards.

 I prefer calling PHP as Web Framework of C and C++

 if you had a time for this fruitless discussion. Please send your
 opinions.

 Regards

 Sancar



 I think that you can't assume that PHP is a C framework for the web,
 basically because when you use a framework (or API or whatever label you
 choose to use  for describing it)  in a language it just abstracts some
 aspects of the language making it easier to code.

 Since you can't compile PHP (as you would probably need to do with a C API)
 and since you don't even need C to write something in PHP you can't call it
 a C or C++ framework.

 In addition to this there is an API for C that can be used to code web
 applications and it is known as CGI (it is provided by many languages)

 PHP is coded in C and some things are similar in syntax and style but this
 is the only relation I can find between the two.

 --
 Thodoris


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



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



Re: [PHP] Re: Reverse IP lookup

2009-02-16 Thread Lewis Wright
I don't think you can unfortunately.

2009/2/16 Brian Dunning br...@briandunning.com:
 And an equally important question: How do you prevent your servers from
 showing up in searches like this?

 On Feb 16, 2009, at 7:51 AM, Lewis Wright wrote:

 This may be a little more accurate:
 http://www.domaintools.com/reverse-ip/




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



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