RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Ford, Mike [LSS]

 -Original Message-
 From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
 Sent: 28 May 2002 20:21
 
 If I write a comment line with // and I include in it ? then 
 it fails to parse the rest of the page because (i'm guessing) 
 the parser gets confused and goes off PHP mode. 
 Is this normal? Shouldn't I be able to write literally 
 ANYTHING on a comment line?

Quoting from http://www.php.net/manual/en/language.basic-syntax.comments.php:

  The one-line comment styles actually only comment to the end
  of the line or the current block of PHP code, whichever comes
  first.

So this is documented behaviour.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Ford, Mike [LSS]

 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: 28 May 2002 21:53
 
 No, if you use /* ? */ as a comment the parser will skip right over 
 it.if you want to use sample code in your script just use:
 
 /*
 ?
 code here
 ?
 */
 
 that'll work fine

hmm, this brings up an interesting point.  Whilst this is valid PHP, it is not really 
valid HTML and certainly not XML.

Displaying a page which contains a ? embedded in a quoted string or /* */ comment in 
an HTML editor which knows about XML-style ?token syntax, but not PHP specifically, 
may result in the PHP block apparently terminating at the embedded ? -- this happens 
in, for example, Dreamweaver 4, which displays a php, but terminates it at the 
*first* occurrence of ? regardless of where that appears.

The XML syntax specifies that a block starting with ?token consists of any characters 
not including ?, terminating at the first occurrence of ?.  It makes no allowance 
for the internal syntax of any such block, so any true XML parser would also terminate 
a ?php block at the first ?, regardless of other context.

It would appear that if PHP wishes to be fully XML-compliant in the future, it 
actually needs to change so that ? terminates a PHP block *regardless of context*.  
Whether such a change of behaviour is actually desirable is something the PHP 
community will have to decide.

(Incidentally, this mirrors the HTML/JavaScript situation where you *cannot* echo the 
string /script in one go as it terminates the script block.  This why you 
sometimes see constructions such as document.write(/+script)!)

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Jay Blanchard

[snip]
...lots of stuff from lots of messages...
[/snip]

If you need to display PHP code in an HTML page and have it validate
properly you need to use the following;

lt;? php ?gt; which will properly display as
? php ?

As a matter of course it is typical to use lt; () and gt; () along with
a set of pre-formatted tags (pre/pre) when using HTML to display code.
Many online magazines have adopted this syntax for code display. Therefore;

pre
lt;? php
//lots of code here
if(foo == bar){
do some stuff;
}
else {
do other stuff;
}
//now do some HTML
print(lt;titlegt; . $title_variable . lt;/titlegt;)
?gt;
/pre

will display the code block and its comments properly in an HTML page.

HTH!

Jay



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




RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Brinkman, Theodore

It really should ignore anything in any sort of comment.  The whole point of
a comment is that it provides the programmer with information and is ignored
by the compiler/interpreter.  If // is supposed to comment until the end of
the line, then by god, it should comment until the end of the line, not
until the end of the line unless it finds ? buried in the line somewhere.
Even VB gets this right!

- Theo

-Original Message-
From: Kevin Stone [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 5:04 PM
To: [EMAIL PROTECTED]; Ed Gorski
Subject: Re: [PHP] comment followed by ? fails to parse


Hrm.. that's possible.  I'm running v4.12
-Kevin

- Original Message -
From: Ed Gorski [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 3:01 PM
Subject: Re: [PHP] comment followed by ? fails to parse


 What version of php are you using?  I just pasted that code in test script
 and it came out fine with 4.2.1.maybe it wasn't the case in earlier
 versions...

 ed

 At 02:57 PM 5/28/2002 -0600, Kevin Stone wrote:
 OH NO IT WON'T.It'll comment out the ? and parse the ?  and give
you a
 parse error.
 
 ?
 /*?comment here?*/
 
 echo hello;
 ?
 
 
 - Original Message -
 From: Ed Gorski [EMAIL PROTECTED]
 To: Kevin Stone [EMAIL PROTECTED]; Jonathan Rosenberg
 [EMAIL PROTECTED]; Johnson Kirk [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Tuesday, May 28, 2002 2:52 PM
 Subject: Re: [PHP] comment followed by ? fails to parse
 
 
   No, if you use /* ? */ as a comment the parser will skip right over
   it.if you want to use sample code in your script just use:
  
   /*
   ?
   code here
   ?
   */
  
   that'll work fine
  
   ed
  
   At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
   I've run into this before as well.  Pain in the ass when you want to
put
   example code in your header.  It's gotta be a deisgn flaw.
   
   // literal.. legal
   $tmp = '?';
   
   // reg ex.. legal
   ereg('?', $tmp);
   
   // Comment.. illegal.  Why?  Makes no sense.
   /*?*/
   
   -Kevin
   
   
   - Original Message -
   From: Jonathan Rosenberg [EMAIL PROTECTED]
   To: Johnson, Kirk [EMAIL PROTECTED];
[EMAIL PROTECTED]
   Sent: Tuesday, May 28, 2002 2:46 PM
   Subject: RE: [PHP] comment followed by ? fails to parse
   
   
 BTW: if my last message was correct, this means that an
 occurrence of ? embedded in a string literal will also cause
 problems.

  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 4:08 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  I have wondered for some time if this is a bug or just
  an interesting design
  choice ;) I agree with you, I was surprised when I
  first encountered this.
  But it is what it is, so code accordingly.
 
  Kirk
 
   -Original Message-
   From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 1:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] comment followed by ? fails to parse
  
  
   If I write a comment line with // and I include in
  it ? then
   it fails to parse the rest of the page because (i'm
  guessing)
   the parser gets confused and goes off PHP mode.
   Is this normal? Shouldn't I be able to write literally
   ANYTHING on a comment line?
  
   Sample Code:
  
   ?
   //bla bla ?
   $var=1;
   ?
  
   Output:
  
   $var=1; ?
  
  
   cheers,
   thalis
 
  --
  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


   
   
   
   --
   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




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




Re: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Jason Wong

On Wednesday 29 May 2002 21:10, Brinkman, Theodore wrote:
 It really should ignore anything in any sort of comment.  The whole point
 of a comment is that it provides the programmer with information and is
 ignored by the compiler/interpreter.  If // is supposed to comment until
 the end of the line, then by god, it should comment until the end of the
 line, not until the end of the line unless it finds ? buried in the line
 somewhere. Even VB gets this right!

As someone has already pointed out that is documented behaviour. Personally I 
agree with you in that the whole line should be commented.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Life is too important to take seriously.
-- Corky Siegel
*/


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




Re: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Ed Gorski

Bah quit complaining, you should be using /* comments */ anyway.

ed

At 09:16 PM 5/29/2002 +0800, Jason Wong wrote:
On Wednesday 29 May 2002 21:10, Brinkman, Theodore wrote:
  It really should ignore anything in any sort of comment.  The whole point
  of a comment is that it provides the programmer with information and is
  ignored by the compiler/interpreter.  If // is supposed to comment until
  the end of the line, then by god, it should comment until the end of the
  line, not until the end of the line unless it finds ? buried in the line
  somewhere. Even VB gets this right!

As someone has already pointed out that is documented behaviour. Personally I
agree with you in that the whole line should be commented.

--
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Life is too important to take seriously.
 -- Corky Siegel
*/


--
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] comment followed by ? fails to parse

2002-05-29 Thread Leotta, Natalie (NCI/IMS)

I disagree.  I use // because then when I need to take out a chunk of code
(the requirements for the programs change faster than I can keep up with
them!!) I can do /* unnecessary code */ and it doesn't end prematurely.

-Natalie

-Original Message-
From: Ed Gorski [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, May 29, 2002 9:25 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] comment followed by ? fails to parse


Bah quit complaining, you should be using /* comments */ anyway.

ed

At 09:16 PM 5/29/2002 +0800, Jason Wong wrote:
On Wednesday 29 May 2002 21:10, Brinkman, Theodore wrote:
  It really should ignore anything in any sort of comment.  The whole 
  point of a comment is that it provides the programmer with 
  information and is ignored by the compiler/interpreter.  If // is 
  supposed to comment until the end of the line, then by god, it 
  should comment until the end of the line, not until the end of the 
  line unless it finds ? buried in the line somewhere. Even VB gets 
  this right!

As someone has already pointed out that is documented behaviour. 
Personally I agree with you in that the whole line should be commented.

--
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
Life is too important to take seriously.
 -- Corky Siegel
*/


--
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

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




Re: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Jason Wong

On Wednesday 29 May 2002 21:27, Leotta, Natalie (NCI/IMS) wrote:
 I disagree.  I use // because then when I need to take out a chunk of code
 (the requirements for the programs change faster than I can keep up with
 them!!) I can do /* unnecessary code */ and it doesn't end prematurely.

Yes this hightlights another shortcoming of PHP in that it cannot have nested 
multi-line comments.

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
For my birthday I got a humidifier and a de-humidifier...  I put them in
the same room and let them fight it out.
-- Steven Wright
*/


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




RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Thalis A. Kalfigopoulos

On Wed, 29 May 2002, Ford, Mike   [LSS] wrote:

  -Original Message-
  From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
  Sent: 28 May 2002 20:21
  
  If I write a comment line with // and I include in it ? then 
  it fails to parse the rest of the page because (i'm guessing) 
  the parser gets confused and goes off PHP mode. 
  Is this normal? Shouldn't I be able to write literally 
  ANYTHING on a comment line?
 
 Quoting from http://www.php.net/manual/en/language.basic-syntax.comments.php:
 
   The one-line comment styles actually only comment to the end
   of the line or the current block of PHP code, whichever comes
   first.
 
 So this is documented behaviour.

Good to know it's documented. Sorry for falling short on my reading skills. But the 
question is: is this decision justified? It would seem more logical to treat a comment 
for what it is: a comment. Any developer find it easy to comment further on this?

TIA,
thalis


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




Re: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Thalis A. Kalfigopoulos

On Wed, 29 May 2002, Jason Wong wrote:

 On Wednesday 29 May 2002 21:27, Leotta, Natalie (NCI/IMS) wrote:
  I disagree.  I use // because then when I need to take out a chunk of code
  (the requirements for the programs change faster than I can keep up with
  them!!) I can do /* unnecessary code */ and it doesn't end prematurely.
 
 Yes this hightlights another shortcoming of PHP in that it cannot have nested 
 multi-line comments.

This is not a shortcoming. This is an issue of the scanner of the compiler. It is not 
possible to remember the nesting level of the comments because of the nature of 
regular expressions: they lack memory.

cheers,
thalis

 
 -- 
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *
 
 /*
 For my birthday I got a humidifier and a de-humidifier...  I put them in
 the same room and let them fight it out.
   -- Steven Wright
 */
 
 
 -- 
 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] comment followed by ? fails to parse

2002-05-29 Thread Jonathan Rosenberg

-Original Message-
 From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 29, 2002 10:27 AM
 To: [EMAIL PROTECTED]
 Subject: Re: [PHP] comment followed by ? fails to parse

 On Wed, 29 May 2002, Jason Wong wrote:

  Yes this hightlights another shortcoming of PHP in
  that it cannot have nested multi-line comments.

 This is not a shortcoming. This is an issue of the
 scanner of the compiler. It is not possible to
 remember the nesting level of the comments because of
 the nature of regular expressions: they lack memory.

You need to brush up on your parsing theory.  If the PHP parser
can balance parentheses, it can balance comments, also.

 cheers,
 thalis

--
JR


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




RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Thalis A. Kalfigopoulos

On Wed, 29 May 2002, Jonathan Rosenberg wrote:

 -Original Message-
  From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
  Sent: Wednesday, May 29, 2002 10:27 AM
  To: [EMAIL PROTECTED]
  Subject: Re: [PHP] comment followed by ? fails to parse
 
  On Wed, 29 May 2002, Jason Wong wrote:
 
   Yes this hightlights another shortcoming of PHP in
   that it cannot have nested multi-line comments.
 
  This is not a shortcoming. This is an issue of the
  scanner of the compiler. It is not possible to
  remember the nesting level of the comments because of
  the nature of regular expressions: they lack memory.
 
 You need to brush up on your parsing theory.  If the PHP parser
 can balance parentheses, it can balance comments, also.

From what I remember from my compilers theory, regexpr is one thing, but grammar 
is another. The parsing phase uses a grammar which is more powerful (every regexpr 
has equivalent grammar but not the other way around). But the comments are usually 
detected and dropped thereof in the scanning phase (prior to parsing). Of course you 
could keep comments around and do the balanced parenthesis matching in the parsing 
phase. Any fallacies in my memory recollection? 

cheers,
thalis



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




RE: [PHP] comment followed by ? fails to parse

2002-05-29 Thread Jonathan Rosenberg

-Original Message-
 From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 29, 2002 1:40 PM
 To: Jonathan Rosenberg
 Cc: [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse

 On Wed, 29 May 2002, Jonathan Rosenberg wrote:

  You need to brush up on your parsing theory.  If the
  PHP parser can balance parentheses, it can balance comments,
  also.

 From what I remember from my compilers theory,
 regexpr is one thing, but grammar is another. The
 parsing phase uses a grammar which is more powerful
 (every regexpr has equivalent grammar but not the
 other way around). But the comments are usually
 detected and dropped thereof in the scanning phase
 (prior to parsing).

If I remember correctly, scanning typically uses a finite state
machine (equivalent to regular expressions), while parsing using
a pushdown automaton (or equivalent).

You are also correct that many (most?) compilers throw out
comments during scanning.

 Of course you could keep comments
 around and do the balanced parenthesis matching in
 the parsing phase.

Some languages support nested comments  do just this.

 Any fallacies in my memory recollection?

Nope.  I think you're correct  I retract my previous criticism.

 cheers,
 thalis


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




[PHP] comment followed by ? fails to parse

2002-05-28 Thread Thalis A. Kalfigopoulos

If I write a comment line with // and I include in it ? then it fails to parse the 
rest of the page because (i'm guessing) the parser gets confused and goes off PHP 
mode. 
Is this normal? Shouldn't I be able to write literally ANYTHING on a comment line?

Sample Code:

?
//bla bla ?
$var=1;
?

Output:

$var=1; ?


cheers,
thalis


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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Johnson, Kirk

I have wondered for some time if this is a bug or just an interesting design
choice ;) I agree with you, I was surprised when I first encountered this.
But it is what it is, so code accordingly.

Kirk

 -Original Message-
 From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 1:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] comment followed by ? fails to parse
 
 
 If I write a comment line with // and I include in it ? then 
 it fails to parse the rest of the page because (i'm guessing) 
 the parser gets confused and goes off PHP mode. 
 Is this normal? Shouldn't I be able to write literally 
 ANYTHING on a comment line?
 
 Sample Code:
 
 ?
 //bla bla ?
 $var=1;
 ?
 
 Output:
 
 $var=1; ?
 
 
 cheers,
 thalis

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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Jonathan Rosenberg

I would think that the first occurrence of ? would/should
terminate the PHP code.  This makes sense because the surrounding
text is HTML  the HTML parser does not understand PHP comments.

Yes?

 -Original Message-
 From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:08 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 I have wondered for some time if this is a bug or just
 an interesting design
 choice ;) I agree with you, I was surprised when I
 first encountered this.
 But it is what it is, so code accordingly.

 Kirk

  -Original Message-
  From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 1:21 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] comment followed by ? fails to parse
 
 
  If I write a comment line with // and I include in
 it ? then
  it fails to parse the rest of the page because (i'm
 guessing)
  the parser gets confused and goes off PHP mode.
  Is this normal? Shouldn't I be able to write literally
  ANYTHING on a comment line?
 
  Sample Code:
 
  ?
  //bla bla ?
  $var=1;
  ?
 
  Output:
 
  $var=1; ?
 
 
  cheers,
  thalis

 --
 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] comment followed by ? fails to parse

2002-05-28 Thread Jonathan Rosenberg

BTW: if my last message was correct, this means that an
occurrence of ? embedded in a string literal will also cause
problems.

 -Original Message-
 From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:08 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 I have wondered for some time if this is a bug or just
 an interesting design
 choice ;) I agree with you, I was surprised when I
 first encountered this.
 But it is what it is, so code accordingly.

 Kirk

  -Original Message-
  From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 1:21 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] comment followed by ? fails to parse
 
 
  If I write a comment line with // and I include in
 it ? then
  it fails to parse the rest of the page because (i'm
 guessing)
  the parser gets confused and goes off PHP mode.
  Is this normal? Shouldn't I be able to write literally
  ANYTHING on a comment line?
 
  Sample Code:
 
  ?
  //bla bla ?
  $var=1;
  ?
 
  Output:
 
  $var=1; ?
 
 
  cheers,
  thalis

 --
 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] comment followed by ? fails to parse

2002-05-28 Thread Leotta, Natalie (NCI/IMS)

But why wouldn't the parser skip right over a // line?  it shouldn't even
see anything in it.

-Original Message-
From: Jonathan Rosenberg [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 28, 2002 4:46 PM
To: Johnson, Kirk; [EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse


BTW: if my last message was correct, this means that an occurrence of ?
embedded in a string literal will also cause problems.

 -Original Message-
 From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:08 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 I have wondered for some time if this is a bug or just
 an interesting design
 choice ;) I agree with you, I was surprised when I
 first encountered this.
 But it is what it is, so code accordingly.

 Kirk

  -Original Message-
  From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 1:21 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] comment followed by ? fails to parse
 
 
  If I write a comment line with // and I include in
 it ? then
  it fails to parse the rest of the page because (i'm
 guessing)
  the parser gets confused and goes off PHP mode.
  Is this normal? Shouldn't I be able to write literally ANYTHING on a 
  comment line?
 
  Sample Code:
 
  ?
  //bla bla ?
  $var=1;
  ?
 
  Output:
 
  $var=1; ?
 
 
  cheers,
  thalis

 --
 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

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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Ed Gorski

No the parser sees the ? after a // because it needs to see when to quit 
out (unlike traditional, compiled languages) but it won't have this same 
effect in a string literal.

ed

At 04:40 PM 5/28/2002 -0400, Leotta, Natalie (NCI/IMS) wrote:
But why wouldn't the parser skip right over a // line?  it shouldn't even
see anything in it.

-Original Message-
From: Jonathan Rosenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 4:46 PM
To: Johnson, Kirk; [EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse


BTW: if my last message was correct, this means that an occurrence of ?
embedded in a string literal will also cause problems.

  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 4:08 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  I have wondered for some time if this is a bug or just
  an interesting design
  choice ;) I agree with you, I was surprised when I
  first encountered this.
  But it is what it is, so code accordingly.
 
  Kirk
 
   -Original Message-
   From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 1:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] comment followed by ? fails to parse
  
  
   If I write a comment line with // and I include in
  it ? then
   it fails to parse the rest of the page because (i'm
  guessing)
   the parser gets confused and goes off PHP mode.
   Is this normal? Shouldn't I be able to write literally ANYTHING on a
   comment line?
  
   Sample Code:
  
   ?
   //bla bla ?
   $var=1;
   ?
  
   Output:
  
   $var=1; ?
  
  
   cheers,
   thalis
 
  --
  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

--
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] comment followed by ? fails to parse

2002-05-28 Thread Leotta, Natalie (NCI/IMS)

That makes sense.  Thanks!

-Natalie

-Original Message-
From: Ed Gorski [mailto:[EMAIL PROTECTED]] 
Sent: Tuesday, May 28, 2002 4:46 PM
To: Leotta, Natalie (NCI/IMS); 'Jonathan Rosenberg'; Johnson Kirk;
[EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse


No the parser sees the ? after a // because it needs to see when to quit 
out (unlike traditional, compiled languages) but it won't have this same 
effect in a string literal.

ed

At 04:40 PM 5/28/2002 -0400, Leotta, Natalie (NCI/IMS) wrote:
But why wouldn't the parser skip right over a // line?  it shouldn't 
even see anything in it.

-Original Message-
From: Jonathan Rosenberg [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 4:46 PM
To: Johnson, Kirk; [EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse


BTW: if my last message was correct, this means that an occurrence of 
? embedded in a string literal will also cause problems.

  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 4:08 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  I have wondered for some time if this is a bug or just
  an interesting design
  choice ;) I agree with you, I was surprised when I
  first encountered this.
  But it is what it is, so code accordingly.
 
  Kirk
 
   -Original Message-
   From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 1:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] comment followed by ? fails to parse
  
  
   If I write a comment line with // and I include in
  it ? then
   it fails to parse the rest of the page because (i'm
  guessing)
   the parser gets confused and goes off PHP mode.
   Is this normal? Shouldn't I be able to write literally ANYTHING on 
   a comment line?
  
   Sample Code:
  
   ?
   //bla bla ?
   $var=1;
   ?
  
   Output:
  
   $var=1; ?
  
  
   cheers,
   thalis
 
  --
  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

--
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] comment followed by ? fails to parse

2002-05-28 Thread Kevin Stone

I've run into this before as well.  Pain in the ass when you want to put
example code in your header.  It's gotta be a deisgn flaw.

// literal.. legal
$tmp = '?';

// reg ex.. legal
ereg('?', $tmp);

// Comment.. illegal.  Why?  Makes no sense.
/*?*/

-Kevin


- Original Message -
From: Jonathan Rosenberg [EMAIL PROTECTED]
To: Johnson, Kirk [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:46 PM
Subject: RE: [PHP] comment followed by ? fails to parse


 BTW: if my last message was correct, this means that an
 occurrence of ? embedded in a string literal will also cause
 problems.

  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 4:08 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  I have wondered for some time if this is a bug or just
  an interesting design
  choice ;) I agree with you, I was surprised when I
  first encountered this.
  But it is what it is, so code accordingly.
 
  Kirk
 
   -Original Message-
   From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 1:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] comment followed by ? fails to parse
  
  
   If I write a comment line with // and I include in
  it ? then
   it fails to parse the rest of the page because (i'm
  guessing)
   the parser gets confused and goes off PHP mode.
   Is this normal? Shouldn't I be able to write literally
   ANYTHING on a comment line?
  
   Sample Code:
  
   ?
   //bla bla ?
   $var=1;
   ?
  
   Output:
  
   $var=1; ?
  
  
   cheers,
   thalis
 
  --
  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





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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Jonathan Rosenberg

The parser needs to emulate the behavior of the HTML parser,
which will match the first ? with the opening ? string.  Make
sense?

 -Original Message-
 From: Leotta, Natalie (NCI/IMS)
 [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:41 PM
 To: 'Jonathan Rosenberg'; Johnson, Kirk;
 [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 But why wouldn't the parser skip right over a // line?
  it shouldn't even
 see anything in it.

 -Original Message-
 From: Jonathan Rosenberg [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:46 PM
 To: Johnson, Kirk; [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 BTW: if my last message was correct, this means that
 an occurrence of ?
 embedded in a string literal will also cause problems.

  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 4:08 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  I have wondered for some time if this is a bug or just
  an interesting design
  choice ;) I agree with you, I was surprised when I
  first encountered this.
  But it is what it is, so code accordingly.
 
  Kirk
 
   -Original Message-
   From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 1:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] comment followed by ? fails to parse
  
  
   If I write a comment line with // and I include in
  it ? then
   it fails to parse the rest of the page because (i'm
  guessing)
   the parser gets confused and goes off PHP mode.
   Is this normal? Shouldn't I be able to write
 literally ANYTHING on a
   comment line?
  
   Sample Code:
  
   ?
   //bla bla ?
   $var=1;
   ?
  
   Output:
  
   $var=1; ?
  
  
   cheers,
   thalis
 
  --
  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



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




Re: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Ed Gorski

No, if you use /* ? */ as a comment the parser will skip right over 
it.if you want to use sample code in your script just use:

/*
?
code here
?
*/

that'll work fine

ed

At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
I've run into this before as well.  Pain in the ass when you want to put
example code in your header.  It's gotta be a deisgn flaw.

// literal.. legal
$tmp = '?';

// reg ex.. legal
ereg('?', $tmp);

// Comment.. illegal.  Why?  Makes no sense.
/*?*/

-Kevin


- Original Message -
From: Jonathan Rosenberg [EMAIL PROTECTED]
To: Johnson, Kirk [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:46 PM
Subject: RE: [PHP] comment followed by ? fails to parse


  BTW: if my last message was correct, this means that an
  occurrence of ? embedded in a string literal will also cause
  problems.
 
   -Original Message-
   From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 4:08 PM
   To: [EMAIL PROTECTED]
   Subject: RE: [PHP] comment followed by ? fails to parse
  
  
   I have wondered for some time if this is a bug or just
   an interesting design
   choice ;) I agree with you, I was surprised when I
   first encountered this.
   But it is what it is, so code accordingly.
  
   Kirk
  
-Original Message-
From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 1:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] comment followed by ? fails to parse
   
   
If I write a comment line with // and I include in
   it ? then
it fails to parse the rest of the page because (i'm
   guessing)
the parser gets confused and goes off PHP mode.
Is this normal? Shouldn't I be able to write literally
ANYTHING on a comment line?
   
Sample Code:
   
?
//bla bla ?
$var=1;
?
   
Output:
   
$var=1; ?
   
   
cheers,
thalis
  
   --
   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
 
 



--
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] comment followed by ? fails to parse

2002-05-28 Thread Kevin Stone

OH NO IT WON'T.It'll comment out the ? and parse the ?  and give you a
parse error.

?
/*?comment here?*/

echo hello;
?


- Original Message -
From: Ed Gorski [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]; Jonathan Rosenberg
[EMAIL PROTECTED]; Johnson Kirk [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:52 PM
Subject: Re: [PHP] comment followed by ? fails to parse


 No, if you use /* ? */ as a comment the parser will skip right over
 it.if you want to use sample code in your script just use:

 /*
 ?
 code here
 ?
 */

 that'll work fine

 ed

 At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
 I've run into this before as well.  Pain in the ass when you want to put
 example code in your header.  It's gotta be a deisgn flaw.
 
 // literal.. legal
 $tmp = '?';
 
 // reg ex.. legal
 ereg('?', $tmp);
 
 // Comment.. illegal.  Why?  Makes no sense.
 /*?*/
 
 -Kevin
 
 
 - Original Message -
 From: Jonathan Rosenberg [EMAIL PROTECTED]
 To: Johnson, Kirk [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, May 28, 2002 2:46 PM
 Subject: RE: [PHP] comment followed by ? fails to parse
 
 
   BTW: if my last message was correct, this means that an
   occurrence of ? embedded in a string literal will also cause
   problems.
  
-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 4:08 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse
   
   
I have wondered for some time if this is a bug or just
an interesting design
choice ;) I agree with you, I was surprised when I
first encountered this.
But it is what it is, so code accordingly.
   
Kirk
   
 -Original Message-
 From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 1:21 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP] comment followed by ? fails to parse


 If I write a comment line with // and I include in
it ? then
 it fails to parse the rest of the page because (i'm
guessing)
 the parser gets confused and goes off PHP mode.
 Is this normal? Shouldn't I be able to write literally
 ANYTHING on a comment line?

 Sample Code:

 ?
 //bla bla ?
 $var=1;
 ?

 Output:

 $var=1; ?


 cheers,
 thalis
   
--
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
  
  
 
 
 
 --
 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] comment followed by ? fails to parse

2002-05-28 Thread Johnson, Kirk

Which begs the question, why does PHP see a '?' in a '//' comment line, but
not in a multi-line comment, e.g., /* ? */ ?

 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 2:46 PM
 To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; Johnson, Kirk;
 [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse
 
 
 No the parser sees the ? after a // because it needs to see 
 when to quit 
 out (unlike traditional, compiled languages) but it won't 
 have this same 
 effect in a string literal.
 
 ed

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




Re: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Kevin Stone

Exactly.. it doesn't seem to make any sense.  Esspecially since it's such as
absolutely incredibly undeniably easy thing to check for.  :)  If the code
doesn't end with an uncommented ? then just parse the code as text.  That's
what it does anyway so why catch commented code at all?

- Original Message -
From: Johnson, Kirk [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:55 PM
Subject: RE: [PHP] comment followed by ? fails to parse


 Which begs the question, why does PHP see a '?' in a '//' comment line,
but
 not in a multi-line comment, e.g., /* ? */ ?

  -Original Message-
  From: Ed Gorski [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 2:46 PM
  To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; Johnson, Kirk;
  [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  No the parser sees the ? after a // because it needs to see
  when to quit
  out (unlike traditional, compiled languages) but it won't
  have this same
  effect in a string literal.
 
  ed

 --
 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] comment followed by ? fails to parse

2002-05-28 Thread Ed Gorski

What version of php are you using?  I just pasted that code in test script 
and it came out fine with 4.2.1.maybe it wasn't the case in earlier 
versions...

ed

At 02:57 PM 5/28/2002 -0600, Kevin Stone wrote:
OH NO IT WON'T.It'll comment out the ? and parse the ?  and give you a
parse error.

?
/*?comment here?*/

echo hello;
?


- Original Message -
From: Ed Gorski [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]; Jonathan Rosenberg
[EMAIL PROTECTED]; Johnson Kirk [EMAIL PROTECTED];
[EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:52 PM
Subject: Re: [PHP] comment followed by ? fails to parse


  No, if you use /* ? */ as a comment the parser will skip right over
  it.if you want to use sample code in your script just use:
 
  /*
  ?
  code here
  ?
  */
 
  that'll work fine
 
  ed
 
  At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
  I've run into this before as well.  Pain in the ass when you want to put
  example code in your header.  It's gotta be a deisgn flaw.
  
  // literal.. legal
  $tmp = '?';
  
  // reg ex.. legal
  ereg('?', $tmp);
  
  // Comment.. illegal.  Why?  Makes no sense.
  /*?*/
  
  -Kevin
  
  
  - Original Message -
  From: Jonathan Rosenberg [EMAIL PROTECTED]
  To: Johnson, Kirk [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Tuesday, May 28, 2002 2:46 PM
  Subject: RE: [PHP] comment followed by ? fails to parse
  
  
BTW: if my last message was correct, this means that an
occurrence of ? embedded in a string literal will also cause
problems.
   
 -Original Message-
 From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:08 PM
 To: [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 I have wondered for some time if this is a bug or just
 an interesting design
 choice ;) I agree with you, I was surprised when I
 first encountered this.
 But it is what it is, so code accordingly.

 Kirk

  -Original Message-
  From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 1:21 PM
  To: [EMAIL PROTECTED]
  Subject: [PHP] comment followed by ? fails to parse
 
 
  If I write a comment line with // and I include in
 it ? then
  it fails to parse the rest of the page because (i'm
 guessing)
  the parser gets confused and goes off PHP mode.
  Is this normal? Shouldn't I be able to write literally
  ANYTHING on a comment line?
 
  Sample Code:
 
  ?
  //bla bla ?
  $var=1;
  ?
 
  Output:
 
  $var=1; ?
 
 
  cheers,
  thalis

 --
 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
   
   
  
  
  
  --
  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


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




Re: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Kevin Stone

Hrm.. that's possible.  I'm running v4.12
-Kevin

- Original Message -
From: Ed Gorski [EMAIL PROTECTED]
To: Kevin Stone [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 3:01 PM
Subject: Re: [PHP] comment followed by ? fails to parse


 What version of php are you using?  I just pasted that code in test script
 and it came out fine with 4.2.1.maybe it wasn't the case in earlier
 versions...

 ed

 At 02:57 PM 5/28/2002 -0600, Kevin Stone wrote:
 OH NO IT WON'T.It'll comment out the ? and parse the ?  and give
you a
 parse error.
 
 ?
 /*?comment here?*/
 
 echo hello;
 ?
 
 
 - Original Message -
 From: Ed Gorski [EMAIL PROTECTED]
 To: Kevin Stone [EMAIL PROTECTED]; Jonathan Rosenberg
 [EMAIL PROTECTED]; Johnson Kirk [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Tuesday, May 28, 2002 2:52 PM
 Subject: Re: [PHP] comment followed by ? fails to parse
 
 
   No, if you use /* ? */ as a comment the parser will skip right over
   it.if you want to use sample code in your script just use:
  
   /*
   ?
   code here
   ?
   */
  
   that'll work fine
  
   ed
  
   At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
   I've run into this before as well.  Pain in the ass when you want to
put
   example code in your header.  It's gotta be a deisgn flaw.
   
   // literal.. legal
   $tmp = '?';
   
   // reg ex.. legal
   ereg('?', $tmp);
   
   // Comment.. illegal.  Why?  Makes no sense.
   /*?*/
   
   -Kevin
   
   
   - Original Message -
   From: Jonathan Rosenberg [EMAIL PROTECTED]
   To: Johnson, Kirk [EMAIL PROTECTED];
[EMAIL PROTECTED]
   Sent: Tuesday, May 28, 2002 2:46 PM
   Subject: RE: [PHP] comment followed by ? fails to parse
   
   
 BTW: if my last message was correct, this means that an
 occurrence of ? embedded in a string literal will also cause
 problems.

  -Original Message-
  From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 4:08 PM
  To: [EMAIL PROTECTED]
  Subject: RE: [PHP] comment followed by ? fails to parse
 
 
  I have wondered for some time if this is a bug or just
  an interesting design
  choice ;) I agree with you, I was surprised when I
  first encountered this.
  But it is what it is, so code accordingly.
 
  Kirk
 
   -Original Message-
   From: Thalis A. Kalfigopoulos [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 1:21 PM
   To: [EMAIL PROTECTED]
   Subject: [PHP] comment followed by ? fails to parse
  
  
   If I write a comment line with // and I include in
  it ? then
   it fails to parse the rest of the page because (i'm
  guessing)
   the parser gets confused and goes off PHP mode.
   Is this normal? Shouldn't I be able to write literally
   ANYTHING on a comment line?
  
   Sample Code:
  
   ?
   //bla bla ?
   $var=1;
   ?
  
   Output:
  
   $var=1; ?
  
  
   cheers,
   thalis
 
  --
  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


   
   
   
   --
   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




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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Jonathan Rosenberg

This seems to me to be inconsistent/buggy behavior on the part of
the PHP parser.

To be consistent, I would think that it would want to act like an
HTML parser (browser), which will recognize the first ?,
regardless of where it occurs.  The idea being that if the PHP
code is passed through a server that doesn't execute PHP, the
code will not appear display.

 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 4:53 PM
 To: Kevin Stone; Jonathan Rosenberg; Johnson Kirk;
 [EMAIL PROTECTED]
 Subject: Re: [PHP] comment followed by ? fails to parse


 No, if you use /* ? */ as a comment the parser will
 skip right over
 it.if you want to use sample code in your script just use:

 /*
 ?
 code here
 ?
 */

 that'll work fine

 ed

 At 02:48 PM 5/28/2002 -0600, Kevin Stone wrote:
 I've run into this before as well.  Pain in the ass
 when you want to put
 example code in your header.  It's gotta be a deisgn flaw.
 
 // literal.. legal
 $tmp = '?';
 
 // reg ex.. legal
 ereg('?', $tmp);
 
 // Comment.. illegal.  Why?  Makes no sense.
 /*?*/
 
 -Kevin
 
 
 - Original Message -
 From: Jonathan Rosenberg [EMAIL PROTECTED]
 To: Johnson, Kirk [EMAIL PROTECTED];
 [EMAIL PROTECTED]
 Sent: Tuesday, May 28, 2002 2:46 PM
 Subject: RE: [PHP] comment followed by ? fails to parse
 
 
   BTW: if my last message was correct, this means that an
   occurrence of ? embedded in a string literal will
 also cause
   problems.
  
-Original Message-
From: Johnson, Kirk [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 4:08 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse
   
   
I have wondered for some time if this is a bug or just
an interesting design
choice ;) I agree with you, I was surprised when I
first encountered this.
But it is what it is, so code accordingly.
   
Kirk
   
 -Original Message-
 From: Thalis A. Kalfigopoulos
[mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 1:21 PM
To: [EMAIL PROTECTED]
Subject: [PHP] comment followed by ? fails to parse
   
   
If I write a comment line with // and I include in
   it ? then
it fails to parse the rest of the page because (i'm
   guessing)
the parser gets confused and goes off PHP mode.
Is this normal? Shouldn't I be able to write literally
ANYTHING on a comment line?
   
Sample Code:
   
?
//bla bla ?
$var=1;
?
   
Output:
   
$var=1; ?
   
   
cheers,
thalis
  
   --
   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
 
 



--
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



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




Re: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Ed Gorski

 From my experience the PHP parser acts much like the HTML parser in the 
fact that it doesn't give a damn about carriage returns

ed

At 03:01 PM 5/28/2002 -0600, Kevin Stone wrote:
Exactly.. it doesn't seem to make any sense.  Esspecially since it's such as
absolutely incredibly undeniably easy thing to check for.  :)  If the code
doesn't end with an uncommented ? then just parse the code as text.  That's
what it does anyway so why catch commented code at all?

- Original Message -
From: Johnson, Kirk [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 2:55 PM
Subject: RE: [PHP] comment followed by ? fails to parse


  Which begs the question, why does PHP see a '?' in a '//' comment line,
but
  not in a multi-line comment, e.g., /* ? */ ?
 
   -Original Message-
   From: Ed Gorski [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, May 28, 2002 2:46 PM
   To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; Johnson, Kirk;
   [EMAIL PROTECTED]
   Subject: RE: [PHP] comment followed by ? fails to parse
  
  
   No the parser sees the ? after a // because it needs to see
   when to quit
   out (unlike traditional, compiled languages) but it won't
   have this same
   effect in a string literal.
  
   ed
 
  --
  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


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




RE: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Johnson, Kirk

Well, one thing I know for sure is that there are members of the PHP
develpment team that monitor this list. Maybe one of them will clear this up
for us ;)

Kirk

 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 3:04 PM
 To: Kevin Stone; [EMAIL PROTECTED]
 Subject: Re: [PHP] comment followed by ? fails to parse
 
 
  From my experience the PHP parser acts much like the HTML 
 parser in the 
 fact that it doesn't give a damn about carriage returns
 
 ed
 
 At 03:01 PM 5/28/2002 -0600, Kevin Stone wrote:
 Exactly.. it doesn't seem to make any sense.  Esspecially 
 since it's such as
 absolutely incredibly undeniably easy thing to check for.  
 :)  If the code
 doesn't end with an uncommented ? then just parse the code 
 as text.  That's
 what it does anyway so why catch commented code at all?
 
 - Original Message -
 From: Johnson, Kirk [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, May 28, 2002 2:55 PM
 Subject: RE: [PHP] comment followed by ? fails to parse
 
 
   Which begs the question, why does PHP see a '?' in a 
 '//' comment line,
 but
   not in a multi-line comment, e.g., /* ? */ ?
  
-Original Message-
From: Ed Gorski [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 28, 2002 2:46 PM
To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg'; 
 Johnson, Kirk;
[EMAIL PROTECTED]
Subject: RE: [PHP] comment followed by ? fails to parse
   
   
No the parser sees the ? after a // because it needs to see
when to quit
out (unlike traditional, compiled languages) but it won't
have this same
effect in a string literal.
   
ed
  
   --
   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
 
 
 -- 
 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] comment followed by ? fails to parse

2002-05-28 Thread Ed Gorski

Well it looks like they got half of it right by changing the /* ? code 
here ? */ issue

ed

At 03:06 PM 5/28/2002 -0600, Johnson, Kirk wrote:
Well, one thing I know for sure is that there are members of the PHP
develpment team that monitor this list. Maybe one of them will clear this up
for us ;)

Kirk

  -Original Message-
  From: Ed Gorski [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, May 28, 2002 3:04 PM
  To: Kevin Stone; [EMAIL PROTECTED]
  Subject: Re: [PHP] comment followed by ? fails to parse
 
 
   From my experience the PHP parser acts much like the HTML
  parser in the
  fact that it doesn't give a damn about carriage returns
 
  ed
 
  At 03:01 PM 5/28/2002 -0600, Kevin Stone wrote:
  Exactly.. it doesn't seem to make any sense.  Esspecially
  since it's such as
  absolutely incredibly undeniably easy thing to check for.
  :)  If the code
  doesn't end with an uncommented ? then just parse the code
  as text.  That's
  what it does anyway so why catch commented code at all?
  
  - Original Message -
  From: Johnson, Kirk [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Tuesday, May 28, 2002 2:55 PM
  Subject: RE: [PHP] comment followed by ? fails to parse
  
  
Which begs the question, why does PHP see a '?' in a
  '//' comment line,
  but
not in a multi-line comment, e.g., /* ? */ ?
   
 -Original Message-
 From: Ed Gorski [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, May 28, 2002 2:46 PM
 To: Leotta Natalie (NCI/IMS); 'Jonathan Rosenberg';
  Johnson, Kirk;
 [EMAIL PROTECTED]
 Subject: RE: [PHP] comment followed by ? fails to parse


 No the parser sees the ? after a // because it needs to see
 when to quit
 out (unlike traditional, compiled languages) but it won't
 have this same
 effect in a string literal.

 ed
   
--
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
 
 
  --
  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


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




Re: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Jason Wong

On Wednesday 29 May 2002 05:03, Kevin Stone wrote:
 Hrm.. that's possible.  I'm running v4.12

Works fine on v4.0.6

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
There's such a thing as too much point on a pencil.
-- H. Allen Smith, Let the Crabgrass Grow
*/


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




Re: [PHP] comment followed by ? fails to parse

2002-05-28 Thread Kevin Stone

After you said the commenting worked on 4.06 I tried it again and it worked
for me too (4.12).  How odd.  The first time I tried this it gave me a parse
error.. same exact code (copied and pasted) but maybe it was a browser cache
glitch.  Hmm.. my mistake I guess.  :)
?
/*?comment here?*/
echo hello world;
?

-Kevin

- Original Message -
From: Jason Wong [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, May 28, 2002 3:14 PM
Subject: Re: [PHP] comment followed by ? fails to parse


 On Wednesday 29 May 2002 05:03, Kevin Stone wrote:
  Hrm.. that's possible.  I'm running v4.12

 Works fine on v4.0.6

 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk
 Open Source Software Systems Integrators
 * Web Design  Hosting * Internet  Intranet Applications Development *

 /*
 There's such a thing as too much point on a pencil.
 -- H. Allen Smith, Let the Crabgrass Grow
 */


 --
 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