RE: [PHP] IE7 = end tag?

2007-05-18 Thread Edward Kay


 -Original Message-
 From: Jim Moseby [mailto:[EMAIL PROTECTED]
 Sent: 17 May 2007 21:29
 To: 'rauhspund'; php-general@lists.php.net
 Subject: RE: [PHP] IE7 = end tag?


 
  #-- .meta info
  include(../plugins/lib/pluginmetadata.php);
  $_cached = !empty($_POST);
  ewiki_pmd($_cached);
  #-- defaults for the separately handled database settings in $db[]
  if (!($db = $_REQUEST[db])) {
  $db = array(type = NULL,
  server = localhost,
  dbname = test,
  table = ewiki,
  dir = /tmp,
  dba = /tmp/wiki.dbm,
  );
  }

 I don't know if this will fix your problem, but you have an
 extraneous comma
 after'dba = /tmp/wiki.dbm,'.  Also try enclosing NULL in
 quotes and see
 if your problem goes away.

 JM


The extra comma at the end of the array definition is still valid syntax in
PHP. Try for yourself:

 php -r '$a = array(a = foo, b = bar,); print_r($a);'

NULL is a special type that means just that:
http://uk.php.net/manual/en/language.types.null.php

Enclosing it in quotes will define it as a string, something entirely
different.

The problem described is not to do with the PHP code supplied, but the setup
of the webserver. As Stut correctly said, if PHP code is getting to the
browser then webserver is not configured correctly.

rauhspund, you are actually using a webserver with PHP aren't you and not
just opening the PHP file directly with IE?

Edward

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



RE: [PHP] IE7 = end tag?

2007-05-18 Thread Edward Kay

  The extra comma at the end of the array definition is still
  valid syntax in
  PHP. Try for yourself:
 
   php -r '$a = array(a = foo, b = bar,); print_r($a);'

 Interesting.  Do you mean 'Valid Syntax' in that it 'works without error',
 or 'Valid Syntax' in that 'it was designed to work that way'?  If the
 former, then I would argue as to whether it is valid syntax,
 since depending
 on it would be dangerous.  If the latter, then I have learned
 something new,
 and I'd like to know more about why it is designed to work that
 way, and how
 I could use it to my advantage.


I believe it is the latter, i.e. designed to work that way. I read something
about it a few months ago but annoyingly can't find the reference. The
reasoning was to make it easier for developers to manage files that define
large arrays, such as config files. (You can add extra values to the end,
copy/paste lines etc without having to worry too much about the trailing
commas).

It may only be acceptable in newer versions of PHP though.

 
  NULL is a special type that means just that:
  http://uk.php.net/manual/en/language.types.null.php
 
  Enclosing it in quotes will define it as a string, something entirely
  different.

 I am aware of what a NULL is.  I suggested the quotes as a troubleshooting
 step, since code prior to the NULL was not being displayed.  A 'knee jerk'
 suggestion, I concede. (Feel free to substitite your own
 descriptive phrase
 for 'knee jerk' if you must) :-)

No need - I'm just as guilty as anyone for 'knee-jerk' posting :)

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



Re: [PHP] IE7 = end tag?

2007-05-18 Thread Robin Vickery

On 18/05/07, Jim Moseby [EMAIL PROTECTED] wrote:


 The extra comma at the end of the array definition is still
 valid syntax in
 PHP. Try for yourself:

  php -r '$a = array(a = foo, b = bar,); print_r($a);'

Interesting.  Do you mean 'Valid Syntax' in that it 'works without error',
or 'Valid Syntax' in that 'it was designed to work that way'?


It was designed to work that way (see the 'possible_comma' rule in
zend_language_parser.y)


If the latter, then I have learned something new,
and I'd like to know more about why it is designed to work that way, and how
I could use it to my advantage.


Probably because

 1. People often remove or comment out elements from lists and forget
to remove the
 comma from the new last entry eg:

 $config = array(
foo = bar,
 // baz = wibble
);

 2. Perl already made the final comma optional for similar reasons.

-robin

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



RE: [PHP] IE7 = end tag?

2007-05-18 Thread Jim Moseby
 
 The extra comma at the end of the array definition is still 
 valid syntax in
 PHP. Try for yourself:
 
  php -r '$a = array(a = foo, b = bar,); print_r($a);'

Interesting.  Do you mean 'Valid Syntax' in that it 'works without error',
or 'Valid Syntax' in that 'it was designed to work that way'?  If the
former, then I would argue as to whether it is valid syntax, since depending
on it would be dangerous.  If the latter, then I have learned something new,
and I'd like to know more about why it is designed to work that way, and how
I could use it to my advantage.

 
 NULL is a special type that means just that:
 http://uk.php.net/manual/en/language.types.null.php
 
 Enclosing it in quotes will define it as a string, something entirely
 different.

I am aware of what a NULL is.  I suggested the quotes as a troubleshooting
step, since code prior to the NULL was not being displayed.  A 'knee jerk'
suggestion, I concede. (Feel free to substitite your own descriptive phrase
for 'knee jerk' if you must) :-) 

JM

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



Re: [PHP] IE7 = end tag?

2007-05-17 Thread Stut

rauhspund wrote:

My Browser IE7 reads = as in array declaration as end tag and exit from php.
All text afterwards will displayed as text.


Your browser should not be seeing PHP code, so you might want to start 
by making sure your web server is set up to process PHP files properly.


-Stut

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



RE: [PHP] IE7 = end tag?

2007-05-17 Thread Jim Moseby
 
 #-- .meta info
 include(../plugins/lib/pluginmetadata.php);
 $_cached = !empty($_POST);
 ewiki_pmd($_cached);
 #-- defaults for the separately handled database settings in $db[]
 if (!($db = $_REQUEST[db])) {
 $db = array(type = NULL,
 server = localhost,
 dbname = test,
 table = ewiki,
 dir = /tmp,
 dba = /tmp/wiki.dbm,
 );
 }
 
 
 
 
 NULL, and the following text is displayed in browser
 Who knows how to change this behavior?

I don't know if this will fix your problem, but you have an extraneous comma
after'dba = /tmp/wiki.dbm,'.  Also try enclosing NULL in quotes and see
if your problem goes away.

JM

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