Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #10156 > unrolled thread
| Started by | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| First post | 2013-07-20 12:00 +0100 |
| Last post | 2013-07-23 13:07 +0100 |
| Articles | 20 on this page of 37 — 11 participants |
Back to article view | Back to comp.lang.php
A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-20 12:00 +0100
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-20 12:40 +0100
Re: A curious thing...about tags. Tim Streater <timstreater@greenbee.net> - 2013-07-20 14:29 +0100
Re: A curious thing...about tags. Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-07-20 13:41 +0200
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-20 08:46 -0400
Re: A curious thing...about tags. Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> - 2013-07-20 17:09 +0200
Re: A curious thing...about tags. Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-20 18:12 +0200
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-21 18:08 +0100
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-20 13:40 -0400
Re: A curious thing...about tags. Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-20 18:33 +0000
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-21 18:14 +0100
Re: A curious thing...about tags. Richard Damon <Richard@Damon-Family.org> - 2013-07-21 14:31 -0400
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-21 20:35 +0100
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-21 18:21 -0400
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-22 08:47 +0100
Re: A curious thing...about tags. Tim Streater <timstreater@greenbee.net> - 2013-07-22 09:13 +0100
Re: A curious thing...about tags. "Alex vdB" <alex@invalid> - 2013-07-22 11:15 +0200
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-22 06:30 -0400
Re: A curious thing...about tags. "AvdB" <nomail@example.invalid> - 2013-07-23 00:13 +0200
Re: A curious thing...about tags. Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-07-24 22:58 +0200
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-22 06:31 -0400
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-22 06:31 -0400
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-22 15:25 +0100
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-22 19:46 -0400
Re: A curious thing...about tags. Tim Streater <timstreater@greenbee.net> - 2013-07-22 17:41 +0100
Re: A curious thing...about tags. Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-22 19:14 +0000
Re: A curious thing...about tags. Jerry Stuckle <jstucklex@attglobal.net> - 2013-07-22 17:00 -0400
Re: A curious thing...about tags. Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-22 21:29 +0000
Re: A curious thing...about tags. Christoph Michael Becker <cmbecker69@arcor.de> - 2013-07-23 00:27 +0200
Re: A curious thing...about tags. Jerry Stuckle <jstucklex@attglobal.net> - 2013-07-22 19:27 -0400
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-22 19:56 -0400
Re: A curious thing...about tags. Jerry Stuckle <jstucklex@attglobal.net> - 2013-07-22 20:59 -0400
Re: A curious thing...about tags. The Natural Philosopher <tnp@invalid.invalid> - 2013-07-23 20:02 +0100
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-22 19:52 -0400
Re: A curious thing...about tags. Denis McMahon <denismfmcmahon@gmail.com> - 2013-07-23 09:40 +0000
Re: A curious thing...about tags. Norman Peelman <npeelman@cfl.rr.com> - 2013-07-23 06:22 -0400
Re: A curious thing...about tags. Tim Streater <timstreater@greenbee.net> - 2013-07-23 13:07 +0100
Page 1 of 2 [1] 2 Next page →
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-20 12:00 +0100 |
| Subject | A curious thing...about tags. |
| Message-ID | <ksdqko$thc$1@news.albasani.net> |
I have been absolutely unsuccessful in putting PHP tags in a string. suppose I want my string to be "?> something <?" ? How on earth is it possible to STOP PHP interpreting that as some blasted 'escape to outputting text' ?? -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-20 12:40 +0100 |
| Message-ID | <ksdsvp$2m8$1@news.albasani.net> |
| In reply to | #10156 |
On 20/07/13 12:00, The Natural Philosopher wrote: > > I have been absolutely unsuccessful in putting PHP tags in a string. > > suppose I want my string to be "?> something <?" > > ? > > How on earth is it possible to STOP PHP interpreting that as some > blasted 'escape to outputting text' > ?? > > Ok scrub that. THIS worked. $run="something"; $run="?>".$run; $run= $run."<?"; $run=htmlspecaialchars($run); echo $run; -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-07-20 14:29 +0100 |
| Message-ID | <timstreater-21794F.14293120072013@news.individual.net> |
| In reply to | #10157 |
In article <ksdsvp$2m8$1@news.albasani.net>,
The Natural Philosopher <tnp@invalid.invalid> wrote:
> On 20/07/13 12:00, The Natural Philosopher wrote:
> >
> > I have been absolutely unsuccessful in putting PHP tags in a string.
> >
> > suppose I want my string to be "?> something <?"
> >
> > ?
> >
> > How on earth is it possible to STOP PHP interpreting that as some
> > blasted 'escape to outputting text'
> > ??
> >
> >
> Ok scrub that.
>
> THIS worked.
> $run="something";
> $run="?>".$run;
> $run= $run."<?";
> $run=htmlspecaialchars($run);
> echo $run;
Or even:
echo htmpspecialchars ('?> ' . $something . ' <' . '?php');
--
Tim
"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> |
|---|---|
| Date | 2013-07-20 13:41 +0200 |
| Message-ID | <ksdt1m$2of$1@news.albasani.net> |
| In reply to | #10156 |
The Natural Philosopher schrieb: > suppose I want my string to be "?> something <?" > How on earth is it possible to STOP PHP interpreting that as some > blasted 'escape to outputting text' <?php echo "?> something <?"; Works as expected. In the browser output you'll see "?> something" since the browser will interpret the remaining "<?" as the start of a processing instruction, but when you look at the generated source code, it's all there as it should be. Perhaps you might want <?php echo htmlspecialchars( "?> something <?" ); Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche)
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-07-20 08:46 -0400 |
| Message-ID | <kse0gd$cn0$1@dont-email.me> |
| In reply to | #10156 |
On 07/20/2013 07:00 AM, The Natural Philosopher wrote:
>
> I have been absolutely unsuccessful in putting PHP tags in a string.
>
> suppose I want my string to be "?> something <?"
>
> ?
>
> How on earth is it possible to STOP PHP interpreting that as some
> blasted 'escape to outputting text'
> ??
>
>
Would this do?
<?PHP
for ($loop = 1; $loop <= 30; $loop++)
{
$ic = chr($loop);
$d1 = chr(63).$ic.chr(62);
$d2 = chr(60).$ic.chr(63);
$str = "$d1 something $d2";
echo "char($loop): $str <br>";
}
?>
Looks like chr(5),chr(7),chr(14) and chr(15) work in cli mode as well.
--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
[toc] | [prev] | [next] | [standalone]
| From | Thomas Mlynarczyk <thomas@mlynarczyk-webdesign.de> |
|---|---|
| Date | 2013-07-20 17:09 +0200 |
| Message-ID | <kse97i$s7i$1@news.albasani.net> |
| In reply to | #10156 |
The Natural Philosopher schrieb: > suppose I want my string to be "?> something <?" > How on earth is it possible to STOP PHP interpreting that as some > blasted 'escape to outputting text' Sorry, but I still don't quite see the problem. PHP will happily accept the above string as what it is: a simple string. It will not try to interpret the <? or ?> contained within that string (why should it?). Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche)
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2013-07-20 18:12 +0200 |
| Message-ID | <51eab69a$0$6552$9b4e6d93@newsspool4.arcor-online.net> |
| In reply to | #10163 |
Thomas Mlynarczyk wrote: > The Natural Philosopher schrieb: > >> suppose I want my string to be "?> something <?" >> How on earth is it possible to STOP PHP interpreting that as some >> blasted 'escape to outputting text' > > Sorry, but I still don't quite see the problem. PHP will happily accept > the above string as what it is: a simple string. It will not try to > interpret the <? or ?> contained within that string (why should it?). ACK. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-21 18:08 +0100 |
| Message-ID | <ksh4hf$9rb$1@news.albasani.net> |
| In reply to | #10164 |
On 20/07/13 17:12, Christoph Michael Becker wrote: > Thomas Mlynarczyk wrote: > >> The Natural Philosopher schrieb: >> >>> suppose I want my string to be "?> something <?" >>> How on earth is it possible to STOP PHP interpreting that as some >>> blasted 'escape to outputting text' >> Sorry, but I still don't quite see the problem. PHP will happily accept >> the above string as what it is: a simple string. It will not try to >> interpret the <? or ?> contained within that string (why should it?). > ACK. > the problem isn't having the string, its getting the interpreter to not interpret any way you have of constructing it. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-07-20 13:40 -0400 |
| Message-ID | <ksehn5$3bb$1@dont-email.me> |
| In reply to | #10163 |
On 07/20/2013 11:09 AM, Thomas Mlynarczyk wrote: > The Natural Philosopher schrieb: > >> suppose I want my string to be "?> something <?" >> How on earth is it possible to STOP PHP interpreting that as some >> blasted 'escape to outputting text' > > Sorry, but I still don't quite see the problem. PHP will happily accept > the above string as what it is: a simple string. It will not try to > interpret the <? or ?> contained within that string (why should it?). > > Greetings, > Thomas > Actually, it's the ?> that is causing the problem. If you attempt to: echo "?> something <? something else"; in a browser, you get: ?> something even though view source shows everything to be there. Inserting an 'invisible' character between <? or using htmlspecialchars() which turns the > < into their html equivalents > < as NP found out shows that it's a browser issue, not PHP. -- Norman Registered Linux user #461062 -Have you been to www.php.net yet?-
[toc] | [prev] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2013-07-20 18:33 +0000 |
| Message-ID | <ksel66$lim$4@dont-email.me> |
| In reply to | #10163 |
On Sat, 20 Jul 2013 17:09:37 +0200, Thomas Mlynarczyk wrote: > The Natural Philosopher schrieb: > >> suppose I want my string to be "?> something <?" >> How on earth is it possible to STOP PHP interpreting that as some >> blasted 'escape to outputting text' > Sorry, but I still don't quite see the problem. PHP will happily accept > the above string as what it is: a simple string. It will not try to > interpret the <? or ?> contained within that string (why should it?). Thomas, the problem is with the ability of the poster you are applying to to comprehend and understand string handling in php, and what his browser views as an element. Most of us understood the need to use < and why in html if we wanted a less than symbol within a few months at most of starting to use html. Some others will never understand it. Also, as you have noticed, the failure modes that some people post are not the failures that occur in the circumstances they describe. When you see this, you can usually assume that the person concerned does not, to use a common term, know their arse from their elbow. -- Denis McMahon, denismfmcmahon@gmail.com
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-21 18:14 +0100 |
| Message-ID | <ksh4su$alf$1@news.albasani.net> |
| In reply to | #10166 |
On 20/07/13 19:33, Denis McMahon wrote: > On Sat, 20 Jul 2013 17:09:37 +0200, Thomas Mlynarczyk wrote: > >> The Natural Philosopher schrieb: >> >>> suppose I want my string to be "?> something <?" >>> How on earth is it possible to STOP PHP interpreting that as some >>> blasted 'escape to outputting text' >> Sorry, but I still don't quite see the problem. PHP will happily accept >> the above string as what it is: a simple string. It will not try to >> interpret the <? or ?> contained within that string (why should it?). > Thomas, the problem is with the ability of the poster you are applying to > to comprehend and understand string handling in php, and what his browser > views as an element. > > Most of us understood the need to use < and why in html if we wanted a > less than symbol within a few months at most of starting to use html. > Some others will never understand it. The problem is of course that you have totally failed to understand the problem I was in fact having. It has NOTHING to do with the browser. The string output was never going anywhere NEAR a browser. The problem was how to CONSTRUCT a string using PHP, to put in a file or a database, that contain PHP escape sequences. Without. PHP interpreting them AS escape sequences. That is given the string $something, how to make $new="?>".$something."<?"; without PHP instantly thinking you wanted to print $something on stdout. > Also, as you have noticed, the failure modes that some people post are > not the failures that occur in the circumstances they describe. When you > see this, you can usually assume that the person concerned does not, to > use a common term, know their arse from their elbow. > Or in this case,.. the person his not bothered to understand the actual problem being described. -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Richard Damon <Richard@Damon-Family.org> |
|---|---|
| Date | 2013-07-21 14:31 -0400 |
| Message-ID | <qOVGt.258268$1m3.143111@en-nntp-03.dc1.easynews.com> |
| In reply to | #10168 |
On 7/21/13 1:14 PM, The Natural Philosopher wrote: > On 20/07/13 19:33, Denis McMahon wrote: >> On Sat, 20 Jul 2013 17:09:37 +0200, Thomas Mlynarczyk wrote: >> >>> The Natural Philosopher schrieb: >>> >>>> suppose I want my string to be "?> something <?" >>>> How on earth is it possible to STOP PHP interpreting that as some >>>> blasted 'escape to outputting text' >>> Sorry, but I still don't quite see the problem. PHP will happily accept >>> the above string as what it is: a simple string. It will not try to >>> interpret the <? or ?> contained within that string (why should it?). >> Thomas, the problem is with the ability of the poster you are applying to >> to comprehend and understand string handling in php, and what his browser >> views as an element. >> >> Most of us understood the need to use < and why in html if we wanted a >> less than symbol within a few months at most of starting to use html. >> Some others will never understand it. > The problem is of course that you have totally failed to understand the > problem I was in fact having. > > It has NOTHING to do with the browser. > The string output was never going anywhere NEAR a browser. > > The problem was how to CONSTRUCT a string using PHP, to put in a file or > a database, that contain PHP escape sequences. > > Without. PHP interpreting them AS escape sequences. > > That is given the string $something, how to make > $new="?>".$something."<?"; > > without PHP instantly thinking you wanted to print $something on stdout. > > >> Also, as you have noticed, the failure modes that some people post are >> not the failures that occur in the circumstances they describe. When you >> see this, you can usually assume that the person concerned does not, to >> use a common term, know their arse from their elbow. >> > Or in this case,.. the person his not bothered to understand the actual > problem being described. > > The issue is that the PHP interpreter is defined to be smart enough that the ?> closing tag should NOT be recognized inside a quoted string the way you have stated. It is almost certainly some other problem. Can you post an EXACT COMPLETE example showing the problem and the output you get (view source on the page)?
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-21 20:35 +0100 |
| Message-ID | <kshd57$sa2$3@news.albasani.net> |
| In reply to | #10169 |
On 21/07/13 19:31, Richard Damon wrote: > On 7/21/13 1:14 PM, The Natural Philosopher wrote: >> On 20/07/13 19:33, Denis McMahon wrote: >>> On Sat, 20 Jul 2013 17:09:37 +0200, Thomas Mlynarczyk wrote: >>> >>>> The Natural Philosopher schrieb: >>>> >>>>> suppose I want my string to be "?> something <?" >>>>> How on earth is it possible to STOP PHP interpreting that as some >>>>> blasted 'escape to outputting text' >>>> Sorry, but I still don't quite see the problem. PHP will happily accept >>>> the above string as what it is: a simple string. It will not try to >>>> interpret the <? or ?> contained within that string (why should it?). >>> Thomas, the problem is with the ability of the poster you are applying to >>> to comprehend and understand string handling in php, and what his browser >>> views as an element. >>> >>> Most of us understood the need to use < and why in html if we wanted a >>> less than symbol within a few months at most of starting to use html. >>> Some others will never understand it. >> The problem is of course that you have totally failed to understand the >> problem I was in fact having. >> >> It has NOTHING to do with the browser. >> The string output was never going anywhere NEAR a browser. >> >> The problem was how to CONSTRUCT a string using PHP, to put in a file or >> a database, that contain PHP escape sequences. >> >> Without. PHP interpreting them AS escape sequences. >> >> That is given the string $something, how to make >> $new="?>".$something."<?"; >> >> without PHP instantly thinking you wanted to print $something on stdout. >> >> >>> Also, as you have noticed, the failure modes that some people post are >>> not the failures that occur in the circumstances they describe. When you >>> see this, you can usually assume that the person concerned does not, to >>> use a common term, know their arse from their elbow. >>> >> Or in this case,.. the person his not bothered to understand the actual >> problem being described. >> >> > The issue is that the PHP interpreter is defined to be smart enough that > the ?> closing tag should NOT be recognized inside a quoted string the > way you have stated. It is almost certainly some other problem. > > Can you post an EXACT COMPLETE example showing the problem and the > output you get (view source on the page)? I managed to get it to work, as I stated earlier.. This was the final code which works, hopefully not by some versional quirk $run="?>".$run; $run= $run."<?"; -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-07-21 18:21 -0400 |
| Message-ID | <kshmi5$sm1$1@dont-email.me> |
| In reply to | #10170 |
On 07/21/2013 03:35 PM, The Natural Philosopher wrote: > On 21/07/13 19:31, Richard Damon wrote: >> On 7/21/13 1:14 PM, The Natural Philosopher wrote: >>> On 20/07/13 19:33, Denis McMahon wrote: >>>> On Sat, 20 Jul 2013 17:09:37 +0200, Thomas Mlynarczyk wrote: >>>> >>>>> The Natural Philosopher schrieb: >>>>> >>>>>> suppose I want my string to be "?> something <?" >>>>>> How on earth is it possible to STOP PHP interpreting that as some >>>>>> blasted 'escape to outputting text' >>>>> Sorry, but I still don't quite see the problem. PHP will happily >>>>> accept >>>>> the above string as what it is: a simple string. It will not try to >>>>> interpret the <? or ?> contained within that string (why should it?). >>>> Thomas, the problem is with the ability of the poster you are >>>> applying to >>>> to comprehend and understand string handling in php, and what his >>>> browser >>>> views as an element. >>>> >>>> Most of us understood the need to use < and why in html if we >>>> wanted a >>>> less than symbol within a few months at most of starting to use html. >>>> Some others will never understand it. >>> The problem is of course that you have totally failed to understand the >>> problem I was in fact having. >>> >>> It has NOTHING to do with the browser. >>> The string output was never going anywhere NEAR a browser. >>> >>> The problem was how to CONSTRUCT a string using PHP, to put in a file or >>> a database, that contain PHP escape sequences. >>> >>> Without. PHP interpreting them AS escape sequences. >>> >>> That is given the string $something, how to make >>> $new="?>".$something."<?"; >>> >>> without PHP instantly thinking you wanted to print $something on >>> stdout. >>> >>> >>>> Also, as you have noticed, the failure modes that some people post are >>>> not the failures that occur in the circumstances they describe. When >>>> you >>>> see this, you can usually assume that the person concerned does not, to >>>> use a common term, know their arse from their elbow. >>>> >>> Or in this case,.. the person his not bothered to understand the actual >>> problem being described. >>> >>> >> The issue is that the PHP interpreter is defined to be smart enough that >> the ?> closing tag should NOT be recognized inside a quoted string the >> way you have stated. It is almost certainly some other problem. >> >> Can you post an EXACT COMPLETE example showing the problem and the >> output you get (view source on the page)? > I managed to get it to work, as I stated earlier.. > > This was the final code which works, hopefully not by some versional quirk > > $run="?>".$run; > $run= $run."<?"; > > > If that works, then so should your original example... as well as: $run="?> $something <?"; Can you post an example of what wasn't working with output? And where the output is going? Cannot duplicate here. norman@amd64x2:~$ php -version PHP 5.3.2-1ubuntu4.19 with Suhosin-Patch (cli) (built: Mar 11 2013 15:23:48) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies norman@amd64x2:~$ php -a Interactive shell php > $something="my text"; php > $run="?> $something <?"; php > echo $run; ?> my text <? -- Norman Registered Linux user #461062 -Have you been to www.php.net yet?-
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-07-22 08:47 +0100 |
| Message-ID | <ksio2o$6l2$1@news.albasani.net> |
| In reply to | #10171 |
On 21/07/13 23:21, Norman Peelman wrote: > On 07/21/2013 03:35 PM, The Natural Philosopher wrote: >> On 21/07/13 19:31, Richard Damon wrote: >>> On 7/21/13 1:14 PM, The Natural Philosopher wrote: >>>> On 20/07/13 19:33, Denis McMahon wrote: >>>>> On Sat, 20 Jul 2013 17:09:37 +0200, Thomas Mlynarczyk wrote: >>>>> >>>>>> The Natural Philosopher schrieb: >>>>>> >>>>>>> suppose I want my string to be "?> something <?" >>>>>>> How on earth is it possible to STOP PHP interpreting that as some >>>>>>> blasted 'escape to outputting text' >>>>>> Sorry, but I still don't quite see the problem. PHP will happily >>>>>> accept >>>>>> the above string as what it is: a simple string. It will not try to >>>>>> interpret the <? or ?> contained within that string (why should >>>>>> it?). >>>>> Thomas, the problem is with the ability of the poster you are >>>>> applying to >>>>> to comprehend and understand string handling in php, and what his >>>>> browser >>>>> views as an element. >>>>> >>>>> Most of us understood the need to use < and why in html if we >>>>> wanted a >>>>> less than symbol within a few months at most of starting to use html. >>>>> Some others will never understand it. >>>> The problem is of course that you have totally failed to understand >>>> the >>>> problem I was in fact having. >>>> >>>> It has NOTHING to do with the browser. >>>> The string output was never going anywhere NEAR a browser. >>>> >>>> The problem was how to CONSTRUCT a string using PHP, to put in a >>>> file or >>>> a database, that contain PHP escape sequences. >>>> >>>> Without. PHP interpreting them AS escape sequences. >>>> >>>> That is given the string $something, how to make >>>> $new="?>".$something."<?"; >>>> >>>> without PHP instantly thinking you wanted to print $something on >>>> stdout. >>>> >>>> >>>>> Also, as you have noticed, the failure modes that some people post >>>>> are >>>>> not the failures that occur in the circumstances they describe. When >>>>> you >>>>> see this, you can usually assume that the person concerned does >>>>> not, to >>>>> use a common term, know their arse from their elbow. >>>>> >>>> Or in this case,.. the person his not bothered to understand the >>>> actual >>>> problem being described. >>>> >>>> >>> The issue is that the PHP interpreter is defined to be smart enough >>> that >>> the ?> closing tag should NOT be recognized inside a quoted string the >>> way you have stated. It is almost certainly some other problem. >>> >>> Can you post an EXACT COMPLETE example showing the problem and the >>> output you get (view source on the page)? >> I managed to get it to work, as I stated earlier.. >> >> This was the final code which works, hopefully not by some versional >> quirk >> >> $run="?>".$run; >> $run= $run."<?"; >> >> >> > > If that works, then so should your original example... as well as: > > $run="?> $something <?"; > > Can you post an example of what wasn't working with output? And > where the output is going? Cannot duplicate here. > > norman@amd64x2:~$ php -version > PHP 5.3.2-1ubuntu4.19 with Suhosin-Patch (cli) (built: Mar 11 2013 > 15:23:48) > Copyright (c) 1997-2009 The PHP Group > Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies > > norman@amd64x2:~$ php -a > Interactive shell > > php > $something="my text"; > php > $run="?> $something <?"; > php > echo $run; > ?> my text <? > > In my setup that produces no output at all. Mind you php -a doesnt produce any output from php> echo "this"; either.. Nor even a command prompt It just sits there... -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2013-07-22 09:13 +0100 |
| Message-ID | <timstreater-CE0247.09134222072013@news.individual.net> |
| In reply to | #10172 |
In article <ksio2o$6l2$1@news.albasani.net>, The Natural Philosopher <tnp@invalid.invalid> wrote: > On 21/07/13 23:21, Norman Peelman wrote: > > On 07/21/2013 03:35 PM, The Natural Philosopher wrote: > >> This was the final code which works, hopefully not by some versional > >> quirk > >> > >> $run="?>".$run; > >> $run= $run."<?"; > > If that works, then so should your original example... as well as: > > > > $run="?> $something <?"; > > > > Can you post an example of what wasn't working with output? And > > where the output is going? Cannot duplicate here. > > > > norman@amd64x2:~$ php -version > > PHP 5.3.2-1ubuntu4.19 with Suhosin-Patch (cli) (built: Mar 11 2013 > > 15:23:48) > > Copyright (c) 1997-2009 The PHP Group > > Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies > > > > norman@amd64x2:~$ php -a > > Interactive shell > > > > php > $something="my text"; > > php > $run="?> $something <?"; > > php > echo $run; > > ?> my text <? > > > In my setup that produces no output at all. > Mind you php -a doesnt produce any output from > php> echo "this"; > > either.. > > Nor even a command prompt > > It just sits there... Under OS X that echoes this, IYSWIM. -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
| From | "Alex vdB" <alex@invalid> |
|---|---|
| Date | 2013-07-22 11:15 +0200 |
| Message-ID | <df4de$51ecff45$5468315d$23132@cache1.tilbu1.nb.home.nl> |
| In reply to | #10173 |
>> > php > $something="my text"; >> > php > $run="?> $something <?"; >> > php > echo $run; >> > ?> my text <? >> > >> In my setup that produces no output at all. >> Mind you php -a doesnt produce any output from >> php> echo "this"; >> >> either.. >> >> Nor even a command prompt >> >> It just sits there... > > Under OS X that echoes this, IYSWIM. I guess you all have different default options/settings. Mine just outputs: echo "this"; as expected, because it isn't processed as PHP, because it is missing <?php I do need to give end of file before anything is output. php -a <?php $run="?> something <"; echo $run; outputs "?> something <?" just fine, again once the input is closed with end of file. and the following produces "?> something <?", once the EOF is received: php -a <?php $saysomething="something"; $run="?> $saysomething <?"; echo $run; Maybe try "php -n -a" and don't forget EOF as well as the php opening tag.
[toc] | [prev] | [next] | [standalone]
| From | Norman Peelman <npeelman@cfl.rr.com> |
|---|---|
| Date | 2013-07-22 06:30 -0400 |
| Message-ID | <ksj18q$cqr$1@dont-email.me> |
| In reply to | #10174 |
On 07/22/2013 05:15 AM, Alex vdB wrote: >>> > php > $something="my text"; >>> > php > $run="?> $something <?"; >>> > php > echo $run; >>> > ?> my text <? >>> > >>> In my setup that produces no output at all. >>> Mind you php -a doesnt produce any output from >>> php> echo "this"; >>> >>> either.. >>> >>> Nor even a command prompt >>> >>> It just sits there... >> >> Under OS X that echoes this, IYSWIM. > > I guess you all have different default options/settings. > > Mine just outputs: echo "this"; > as expected, because it isn't processed as PHP, because it is missing <?php > I do need to give end of file before anything is output. > > php -a > <?php $run="?> something <"; > echo $run; > > outputs "?> something <?" just fine, again once the input is closed with > end of file. > > and the following produces "?> something <?", once the EOF is received: > php -a > <?php > $saysomething="something"; > $run="?> $saysomething <?"; > echo $run; > > > Maybe try "php -n -a" and don't forget EOF as well as the php opening tag. norman@amd64x2:~$ php -a Interactive shell php > <?php php > $something = "something"; Parse error: syntax error, unexpected '<' in php shell code on line 1 That doesn't fly here... You seem to be in Interactive Mode not Interactive Shell, there is a difference. http://php.net/manual/en/features.commandline.interactive.php -- Norman Registered Linux user #461062 -Have you been to www.php.net yet?-
[toc] | [prev] | [next] | [standalone]
| From | "AvdB" <nomail@example.invalid> |
|---|---|
| Date | 2013-07-23 00:13 +0200 |
| Message-ID | <kskaqg$gmi$1@speranza.aioe.org> |
| In reply to | #10175 |
> That doesn't fly here... You seem to be in Interactive Mode not > Interactive Shell, there is a difference. Correct. But it seems TNP has the same or at least a similar setup.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-07-24 22:58 +0200 |
| Message-ID | <9504272.kfoSba8VMR@PointedEars.de> |
| In reply to | #10175 |
Norman Peelman wrote:
> On 07/22/2013 05:15 AM, Alex vdB wrote:
>> and the following produces "?> something <?", once the EOF is received:
>> php -a
>> <?php
>> $saysomething="something";
>> $run="?> $saysomething <?";
>> echo $run;
>>
>>
>> Maybe try "php -n -a" and don't forget EOF as well as the php opening
>> tag.
>
> norman@amd64x2:~$ php -a
> Interactive shell
>
> php > <?php
> php > $something = "something";
>
> Parse error: syntax error, unexpected '<' in php shell code on line 1
>
> That doesn't fly here... You seem to be in Interactive Mode not
> Interactive Shell, there is a difference.
>
> http://php.net/manual/en/features.commandline.interactive.php
“php -a” does different things depending on the PHP build options. As it
says there, PHP must be built with readline support for the interactive PHP
shell to be available; otherwise “-a” will read until it receives an EOF
character (Ctrl+*D* on *Unices*, Ctrl+*Z* on *Windows*), and then execute
the program.
Where the built-in PHP shell is not available, like on Debian GNU/Linux,
there is phpsh. However, phpsh's coloring is buggy, so
alias phpsh='phpsh -c'
in e.g. ~/.bashrc, to disable that, is recommended.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.php
csiph-web