FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » A curious thing...about tags.
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
A curious thing...about tags. [message #182205] Sat, 20 July 2013 11:00 Go to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
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.
Re: A curious thing...about tags. [message #182206 is a reply to message #182205] Sat, 20 July 2013 11:40 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
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.
Re: A curious thing...about tags. [message #182207 is a reply to message #182205] Sat, 20 July 2013 11:41 Go to previous messageGo to next message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma: 0
Senior Member
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)
Re: A curious thing...about tags. [message #182208 is a reply to message #182205] Sat, 20 July 2013 12:46 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
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?-
Re: A curious thing...about tags. [message #182210 is a reply to message #182206] Sat, 20 July 2013 13:29 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <ksdsvp$2m8$1(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)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
Re: A curious thing...about tags. [message #182212 is a reply to message #182205] Sat, 20 July 2013 15:09 Go to previous messageGo to next message
Thomas Mlynarczyk is currently offline  Thomas Mlynarczyk
Messages: 131
Registered: September 2010
Karma: 0
Senior Member
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)
Re: A curious thing...about tags. [message #182213 is a reply to message #182212] Sat, 20 July 2013 16:12 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
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
Re: A curious thing...about tags. [message #182214 is a reply to message #182212] Sat, 20 July 2013 17:40 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
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 &gt &lt 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?-
Re: A curious thing...about tags. [message #182215 is a reply to message #182212] Sat, 20 July 2013 18:33 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
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 &lt; 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(at)gmail(dot)com
Re: A curious thing...about tags. [message #182216 is a reply to message #182213] Sun, 21 July 2013 17:08 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
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.
Re: A curious thing...about tags. [message #182217 is a reply to message #182215] Sun, 21 July 2013 17:14 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
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 &lt; 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.
Re: A curious thing...about tags. [message #182218 is a reply to message #182217] Sun, 21 July 2013 18:31 Go to previous messageGo to next message
Richard Damon is currently offline  Richard Damon
Messages: 58
Registered: August 2011
Karma: 0
Member
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 &lt; 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)?
Re: A curious thing...about tags. [message #182219 is a reply to message #182218] Sun, 21 July 2013 19:35 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
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 &lt; 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.
Re: A curious thing...about tags. [message #182220 is a reply to message #182219] Sun, 21 July 2013 22:21 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
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 &lt; 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?-
Re: A curious thing...about tags. [message #182221 is a reply to message #182220] Mon, 22 July 2013 07:47 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
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 &lt; 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.
Re: A curious thing...about tags. [message #182222 is a reply to message #182221] Mon, 22 July 2013 08:13 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <ksio2o$6l2$1(at)news(dot)albasani(dot)net>,
The Natural Philosopher <tnp(at)invalid(dot)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
Re: A curious thing...about tags. [message #182223 is a reply to message #182222] Mon, 22 July 2013 09:15 Go to previous messageGo to next message
Alex vdB is currently offline  Alex vdB
Messages: 3
Registered: November 2012
Karma: 0
Junior Member
>>> 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.
Re: A curious thing...about tags. [message #182224 is a reply to message #182223] Mon, 22 July 2013 10:30 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
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?-
Re: A curious thing...about tags. [message #182225 is a reply to message #182221] Mon, 22 July 2013 10:31 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 07/22/2013 03:47 AM, The Natural Philosopher wrote:
> 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 &lt; 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...
>
>
>
>

Maybe this will help:

http://php.net/manual/en/features.commandline.interactive.php

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: A curious thing...about tags. [message #182226 is a reply to message #182221] Mon, 22 July 2013 10:31 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 07/22/2013 03:47 AM, The Natural Philosopher wrote:
> 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 &lt; 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...
>
>

Well, then how are you 'running' your code? You show a command prompt
above. The interactive shell executes each line as you type it in. I
can't even imagine what your setup is without you telling.


--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: A curious thing...about tags. [message #182227 is a reply to message #182226] Mon, 22 July 2013 14:25 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 22/07/13 11:31, Norman Peelman wrote:
> On 07/22/2013 03:47 AM, The Natural Philosopher wrote:
>> 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...
>>
>>
>
> Well, then how are you 'running' your code? You show a command
> prompt above. The interactive shell executes each line as you type it
> in. I can't even imagine what your setup is without you telling.
>
>
Shrug. I dunno. I merely tries to replaicate te test

$ php -a
Interactive mode enabled

<?
Echo "sodit";
?>

echo "sodit";
Sodit
^C
$

--
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.
Re: A curious thing...about tags. [message #182229 is a reply to message #182226] Mon, 22 July 2013 16:41 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <ksj1ah$cqr$3(at)dont-email(dot)me>,
Norman Peelman <npeelman(at)cfl(dot)rr(dot)com> wrote:

> On 07/22/2013 03:47 AM, The Natural Philosopher wrote:

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

> Well, then how are you 'running' your code? You show a command prompt
> above. The interactive shell executes each line as you type it in. I
> can't even imagine what your setup is without you telling.

Then get a clue. TNP uses PHP at the command line with:

php -a

He then enters:

echo "this";

at the prompt, and it hangs. There. That wasn't too hard to figure out,
was it.

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: A curious thing...about tags. [message #182231 is a reply to message #182229] Mon, 22 July 2013 19:14 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:

> Then get a clue. TNP uses PHP at the command line with:
>
> php -a
>
> He then enters:
>
> echo "this";
>
> at the prompt, and it hangs. There. That wasn't too hard to figure out,
> was it.

Then it's something in his configuration that's different to my command
line configuration.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: A curious thing...about tags. [message #182233 is a reply to message #182231] Mon, 22 July 2013 21:00 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/22/2013 3:14 PM, Denis McMahon wrote:
> On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:
>
>> Then get a clue. TNP uses PHP at the command line with:
>>
>> php -a
>>
>> He then enters:
>>
>> echo "this";
>>
>> at the prompt, and it hangs. There. That wasn't too hard to figure out,
>> was it.
>
> Then it's something in his configuration that's different to my command
> line configuration.
>

Works the same for me as it did for Tim.

Maybe you hit ctrl-Z (or ctrl-D on linux)?


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: A curious thing...about tags. [message #182234 is a reply to message #182233] Mon, 22 July 2013 21:29 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Mon, 22 Jul 2013 17:00:00 -0400, Jerry Stuckle wrote:

> On 7/22/2013 3:14 PM, Denis McMahon wrote:
>> On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:
>>
>>> Then get a clue. TNP uses PHP at the command line with:
>>>
>>> php -a
>>>
>>> He then enters:
>>>
>>> echo "this";
>>>
>>> at the prompt, and it hangs. There. That wasn't too hard to figure
>>> out,
>>> was it.
>>
>> Then it's something in his configuration that's different to my command
>> line configuration.
>>
>>
> Works the same for me as it did for Tim.
>
> Maybe you hit ctrl-Z (or ctrl-D on linux)?

Nope, I did the following as Tim posted, starting from a shell prompt:

php -a
echo "this";

And what appears on my screen is this:

$ php -a
Interactive shell

php > echo "this";
this
php > exit
$

So if TNPs system is hanging after he enters the 'echo "this";' then my
bet is that it's something he did to his configuration.

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: A curious thing...about tags. [message #182235 is a reply to message #182224] Mon, 22 July 2013 22:13 Go to previous messageGo to next message
AvdB is currently offline  AvdB
Messages: 2
Registered: July 2013
Karma: 0
Junior Member
> 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.
Re: A curious thing...about tags. [message #182236 is a reply to message #182234] Mon, 22 July 2013 22:27 Go to previous messageGo to next message
Christoph Michael Bec is currently offline  Christoph Michael Bec
Messages: 207
Registered: June 2013
Karma: 0
Senior Member
Denis McMahon wrote:

> So if TNPs system is hanging after he enters the 'echo "this";' then my
> bet is that it's something he did to his configuration.

That's the difference between interactive *shell* and interactive *mode*
(see <http://php.net/manual/en/features.commandline.interactive.php>).
Giving a proper --with-readline option to the build process might not
always suffice (at least I was not able to compile PHP, so that it
offers the interactive shell, under Cygwin).

--
Christoph M. Becker
Re: A curious thing...about tags. [message #182237 is a reply to message #182234] Mon, 22 July 2013 23:27 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/22/2013 5:29 PM, Denis McMahon wrote:
> On Mon, 22 Jul 2013 17:00:00 -0400, Jerry Stuckle wrote:
>
>> On 7/22/2013 3:14 PM, Denis McMahon wrote:
>>> On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:
>>>
>>>> Then get a clue. TNP uses PHP at the command line with:
>>>>
>>>> php -a
>>>>
>>>> He then enters:
>>>>
>>>> echo "this";
>>>>
>>>> at the prompt, and it hangs. There. That wasn't too hard to figure
>>>> out,
>>>> was it.
>>>
>>> Then it's something in his configuration that's different to my command
>>> line configuration.
>>>
>>>
>> Works the same for me as it did for Tim.
>>
>> Maybe you hit ctrl-Z (or ctrl-D on linux)?
>
> Nope, I did the following as Tim posted, starting from a shell prompt:
>
> php -a
> echo "this";
>
> And what appears on my screen is this:
>
> $ php -a
> Interactive shell
>
> php > echo "this";
> this
> php > exit
> $
>
> So if TNPs system is hanging after he enters the 'echo "this";' then my
> bet is that it's something he did to his configuration.
>

What I get in both Windows and Linux is:

C:\>php -a
Interactive mode enabled

echo "this";

Then after doing ctrl-Z (ctrl-D in Linux)

echo "this";

I could check through the php.ini options to see what affects this, but
considering the source of the problem, I really don't care.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: A curious thing...about tags. [message #182238 is a reply to message #182227] Mon, 22 July 2013 23:46 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 07/22/2013 10:25 AM, The Natural Philosopher wrote:
> On 22/07/13 11:31, Norman Peelman wrote:
>> On 07/22/2013 03:47 AM, The Natural Philosopher wrote:
>>> 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...
>>>
>>>
>>
>> Well, then how are you 'running' your code? You show a command
>> prompt above. The interactive shell executes each line as you type it
>> in. I can't even imagine what your setup is without you telling.
>>
>>
> Shrug. I dunno. I merely tries to replaicate te test
>
> $ php -a
> Interactive mode enabled
>
> <?
> Echo "sodit";
> ?>
>
> echo "sodit";
> Sodit
> ^C
> $
>

You are in 'Interactive Mode', not 'Interactive Shell'. You just
need to type (press enter after each line):

$ php -a
Interactive mode enabled

<?php
echo "?> something <?";
?>
press CTRL-D (or Z maybe)

---

It's a compilation option --with-readline (or lack of) that causes it
to revert to this mode. I don't feel like compiling PHP just to find
out. Give it a go.

--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: A curious thing...about tags. [message #182239 is a reply to message #182229] Mon, 22 July 2013 23:52 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 07/22/2013 12:41 PM, Tim Streater wrote:
> In article <ksj1ah$cqr$3(at)dont-email(dot)me>,
> Norman Peelman <npeelman(at)cfl(dot)rr(dot)com> wrote:
>
>> On 07/22/2013 03:47 AM, The Natural Philosopher wrote:
>
>>>> 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...
>
>> Well, then how are you 'running' your code? You show a command
>> prompt above. The interactive shell executes each line as you type it
>> in. I can't even imagine what your setup is without you telling.
>
> Then get a clue. TNP uses PHP at the command line with:
>
> php -a
>
> He then enters:
>
> echo "this";
>
> at the prompt, and it hangs. There. That wasn't too hard to figure out,
> was it.
>

It's not hanging, but waiting for proper EOF. But also probably needs
proper starting and ending tags as well.


<?php
echo "?> something <?";
?>
CTRL-D (or Z maybe)


--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: A curious thing...about tags. [message #182240 is a reply to message #182237] Mon, 22 July 2013 23:56 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 07/22/2013 07:27 PM, Jerry Stuckle wrote:
> On 7/22/2013 5:29 PM, Denis McMahon wrote:
>> On Mon, 22 Jul 2013 17:00:00 -0400, Jerry Stuckle wrote:
>>
>>> On 7/22/2013 3:14 PM, Denis McMahon wrote:
>>>> On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:
>>>>
>>>> > Then get a clue. TNP uses PHP at the command line with:
>>>> >
>>>> > php -a
>>>> >
>>>> > He then enters:
>>>> >
>>>> > echo "this";
>>>> >
>>>> > at the prompt, and it hangs. There. That wasn't too hard to figure
>>>> > out,
>>>> > was it.
>>>>
>>>> Then it's something in his configuration that's different to my command
>>>> line configuration.
>>>>
>>>>
>>> Works the same for me as it did for Tim.
>>>
>>> Maybe you hit ctrl-Z (or ctrl-D on linux)?
>>
>> Nope, I did the following as Tim posted, starting from a shell prompt:
>>
>> php -a
>> echo "this";
>>
>> And what appears on my screen is this:
>>
>> $ php -a
>> Interactive shell
>>
>> php > echo "this";
>> this
>> php > exit
>> $
>>
>> So if TNPs system is hanging after he enters the 'echo "this";' then my
>> bet is that it's something he did to his configuration.
>>
>
> What I get in both Windows and Linux is:
>
> C:\>php -a
> Interactive mode enabled
>
> echo "this";
>
> Then after doing ctrl-Z (ctrl-D in Linux)
>
> echo "this";
>
> I could check through the php.ini options to see what affects this, but
> considering the source of the problem, I really don't care.
>

I do believe you need to use proper starting and ending tags. You're
output indicates PHP has simply passed-thru the text you entered. But
yes CTRL-D or Z maybe should be the proper way to 'run' the code in
Interactive *Mode*



--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: A curious thing...about tags. [message #182241 is a reply to message #182240] Tue, 23 July 2013 00:59 Go to previous messageGo to next message
Jerry Stuckle is currently offline  Jerry Stuckle
Messages: 2598
Registered: September 2010
Karma: 0
Senior Member
On 7/22/2013 7:56 PM, Norman Peelman wrote:
> On 07/22/2013 07:27 PM, Jerry Stuckle wrote:
>> On 7/22/2013 5:29 PM, Denis McMahon wrote:
>>> On Mon, 22 Jul 2013 17:00:00 -0400, Jerry Stuckle wrote:
>>>
>>>> On 7/22/2013 3:14 PM, Denis McMahon wrote:
>>>> > On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:
>>>> >
>>>> >> Then get a clue. TNP uses PHP at the command line with:
>>>> >>
>>>> >> php -a
>>>> >>
>>>> >> He then enters:
>>>> >>
>>>> >> echo "this";
>>>> >>
>>>> >> at the prompt, and it hangs. There. That wasn't too hard to figure
>>>> >> out,
>>>> >> was it.
>>>> >
>>>> > Then it's something in his configuration that's different to my
>>>> > command
>>>> > line configuration.
>>>> >
>>>> >
>>>> Works the same for me as it did for Tim.
>>>>
>>>> Maybe you hit ctrl-Z (or ctrl-D on linux)?
>>>
>>> Nope, I did the following as Tim posted, starting from a shell prompt:
>>>
>>> php -a
>>> echo "this";
>>>
>>> And what appears on my screen is this:
>>>
>>> $ php -a
>>> Interactive shell
>>>
>>> php > echo "this";
>>> this
>>> php > exit
>>> $
>>>
>>> So if TNPs system is hanging after he enters the 'echo "this";' then my
>>> bet is that it's something he did to his configuration.
>>>
>>
>> What I get in both Windows and Linux is:
>>
>> C:\>php -a
>> Interactive mode enabled
>>
>> echo "this";
>>
>> Then after doing ctrl-Z (ctrl-D in Linux)
>>
>> echo "this";
>>
>> I could check through the php.ini options to see what affects this, but
>> considering the source of the problem, I really don't care.
>>
>
> I do believe you need to use proper starting and ending tags. You're
> output indicates PHP has simply passed-thru the text you entered. But
> yes CTRL-D or Z maybe should be the proper way to 'run' the code in
> Interactive *Mode*
>
>
>

I agree with the tags - I've always used them when testing. Here, I was
entering the text exactly as Dennis did, and showing I did NOT get the
results he did.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
Re: A curious thing...about tags. [message #182243 is a reply to message #182239] Tue, 23 July 2013 09:40 Go to previous messageGo to next message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma: 0
Senior Member
On Mon, 22 Jul 2013 19:52:14 -0400, Norman Peelman wrote:

> It's not hanging, but waiting for proper EOF. But also probably needs
> proper starting and ending tags as well.

> <?php echo "?> something <?";
> ?>
> CTRL-D (or Z maybe)

Not in my setup:

Starting at a command shell, the only things I type are the following 3
lines:

php -a
echo "this";
exit

What appears on my console are the following 7 lines:

$ php -a
Interactive shell

php > echo "this";
this
php > exit
$

--
Denis McMahon, denismfmcmahon(at)gmail(dot)com
Re: A curious thing...about tags. [message #182244 is a reply to message #182243] Tue, 23 July 2013 10:22 Go to previous messageGo to next message
Norman Peelman is currently offline  Norman Peelman
Messages: 126
Registered: September 2010
Karma: 0
Senior Member
On 07/23/2013 05:40 AM, Denis McMahon wrote:
> On Mon, 22 Jul 2013 19:52:14 -0400, Norman Peelman wrote:
>
>> It's not hanging, but waiting for proper EOF. But also probably needs
>> proper starting and ending tags as well.
>
>> <?php echo "?> something <?";
>> ?>
>> CTRL-D (or Z maybe)
>
> Not in my setup:
>
> Starting at a command shell, the only things I type are the following 3
> lines:
>
> php -a
> echo "this";
> exit
>
> What appears on my console are the following 7 lines:
>
> $ php -a
> Interactive shell
>
> php > echo "this";
> this
> php > exit
> $
>

Dennis,

You and I have the 'Interactive *SHELL*' and that is the way it is
supposed to work. 'Interactive *MODE* is something different. You can't
pick which one you use at the terminal.

http://php.net/manual/en/features.commandline.interactive.php


"Interactive *MODE* is essentially like running php with stdin as the
file input. You just type code, and when you're done (Ctrl-D), php
executes whatever you typed as if it were a normal PHP (PHTML) file -
hence you start in interactive *mode* with '<?php' in order to execute
code."

http://www.php.net/manual/en/features.commandline.interactive.php#108006

https://bugs.php.net/bug.php?id=60683
It's not a bug, read the history down to the bottom.


--
Norman
Registered Linux user #461062
-Have you been to www.php.net yet?-
Re: A curious thing...about tags. [message #182245 is a reply to message #182243] Tue, 23 July 2013 12:07 Go to previous messageGo to next message
Tim Streater is currently offline  Tim Streater
Messages: 328
Registered: September 2010
Karma: 0
Senior Member
In article <kslj24$su3$1(at)dont-email(dot)me>,
Denis McMahon <denismfmcmahon(at)gmail(dot)com> wrote:

> On Mon, 22 Jul 2013 19:52:14 -0400, Norman Peelman wrote:
>
>> It's not hanging, but waiting for proper EOF. But also probably needs
>> proper starting and ending tags as well.
>
>> <?php echo "?> something <?";
>> ?>
>> CTRL-D (or Z maybe)
>
> Not in my setup:
>
> Starting at a command shell, the only things I type are the following 3
> lines:
>
> php -a
> echo "this";
> exit
>
> What appears on my console are the following 7 lines:
>
> $ php -a
> Interactive shell
>
> php > echo "this";
> this
> php > exit
> $

Exactly what I observe (OS X).

--
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
Re: A curious thing...about tags. [message #182246 is a reply to message #182234] Tue, 23 July 2013 19:02 Go to previous messageGo to next message
The Natural Philosoph is currently offline  The Natural Philosoph
Messages: 993
Registered: September 2010
Karma: 0
Senior Member
On 22/07/13 22:29, Denis McMahon wrote:
> On Mon, 22 Jul 2013 17:00:00 -0400, Jerry Stuckle wrote:
>
>> On 7/22/2013 3:14 PM, Denis McMahon wrote:
>>> On Mon, 22 Jul 2013 17:41:13 +0100, Tim Streater wrote:
>>>
>>>> Then get a clue. TNP uses PHP at the command line with:
>>>>
>>>> php -a
>>>>
>>>> He then enters:
>>>>
>>>> echo "this";
>>>>
>>>> at the prompt, and it hangs. There. That wasn't too hard to figure
>>>> out,
>>>> was it.
>>> Then it's something in his configuration that's different to my command
>>> line configuration.
>>>
>>>
>> Works the same for me as it did for Tim.
>>
>> Maybe you hit ctrl-Z (or ctrl-D on linux)?
> Nope, I did the following as Tim posted, starting from a shell prompt:
>
> php -a
> echo "this";
>
> And what appears on my screen is this:
>
> $ php -a
> Interactive shell
>
> php > echo "this";
> this
> php > exit
> $
>
> So if TNPs system is hanging after he enters the 'echo "this";' then my
> bet is that it's something he did to his configuration.
>
I have never configured PHP to use a shell at all.

It is a vanilla debian stable installation.

--
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.
Re: A curious thing...about tags. [message #182247 is a reply to message #182224] Wed, 24 July 2013 20:58 Go to previous message
Thomas 'PointedEars'  is currently offline  Thomas 'PointedEars'
Messages: 701
Registered: October 2010
Karma: 0
Senior Member
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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Paypal IPN and HTTP 1.1
Next Topic: Query with PHP and MySql
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 18 02:21:00 GMT 2024

Total time taken to generate the page: 0.03501 seconds