Any idea on how to progress with this idea?
I certainly would like to see it in PHP 5.4 but i don't have the knowledge
nor time to figure out the php internals (in C...)
On Sat, Apr 23, 2011 at 4:04 AM, Ben Schmidt
wrote:
> yeah you are right, passing arguments by reference doesn't trigger the
>>
yeah you are right, passing arguments by reference doesn't trigger the
notice, but I'm not sure that it is applicable in our case.
Yeah, it wouldn't help. For instance, 42 or "default" can't be passed by
reference, so you couldn't actually provide a default value to
coalesce() if you implemented
On Fri, Apr 22, 2011 at 12:07 AM, Brian Moon wrote:
> which one?
>> I guess that you are talking about the language constructs like isset and
>> empty.
>> they aren't functions.
>>
>
> settype() for one.
>
> Brian.
>
yeah you are right, passing arguments by reference doesn't trigger the
notice,
which one?
I guess that you are talking about the language constructs like isset and
empty.
they aren't functions.
settype() for one.
Brian.
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php
On Thu, Apr 21, 2011 at 8:37 PM, Brian Moon wrote:
> I proposed something similar over 5 years ago. It ain't gonna happen
>> because PHP language can't support it.
>>
>
> It supports it. Several functions allow you to pass in variables that are
> not set and don't throw an error. Not sure what yo
I proposed something similar over 5 years ago. It ain't gonna happen
because PHP language can't support it.
It supports it. Several functions allow you to pass in variables that
are not set and don't throw an error. Not sure what you are talking about.
Brian.
--
PHP Internals - PHP Runtime D
On Wed Apr 20 04:41 PM, D. Dante Lorenso wrote:
>
> My proposal was called "filled" since it was the opposite of "empty"
> which already existed. I extended the function to return the first
> non-empty value or null if all values evaluated as empty.
>
> You could use the function like this:
>
On 4/20/11 9:55 AM, Mark wrote:
Hi,
This proposal is for the often called line like this:
$var = isset($_GET['var']) ? $_GET['var'] : '';
Only a shorter and imho a cleaner solution to get the same:
$var = varset($_GET['var']);
The implementation for this in PHP code is this:
# Arg 1 = the varia
On Wed, Apr 20, 2011 at 6:00 PM, Jonathan Bond-Caron wrote:
> On Wed Apr 20 10:55 AM, Mark wrote:
> >
> > function varset($arr, $key, $default = '') { return (isset($arr[$key])
> > ? $arr[$key] : $default); }
> >
> > where the call would be:
> > $var = varset($_GET, 'var');
> >
> > I personally li
On Wed, Apr 20, 2011 at 7:14 PM, Hannes Landeholm wrote:
> This discussion is equivalent to the one that we just had. Read the thread
> "[PHP-DEV] Implicit isset/isempty check on short-ternary operator".
>
>
except that it wouldn't bring new syntax.
ps: please don't top post if everybody else doe
This discussion is equivalent to the one that we just had. Read the thread
"[PHP-DEV] Implicit isset/isempty check on short-ternary operator".
Also the "$var = var_set($_GET['var'], $_POST['var'], 'default');" syntax
you propose would be equivalent to (as per previous discussion):
$var = $_GET[?'
On Wed, Apr 20, 2011 at 11:06:47AM -0500, Brian Moon wrote:
> >It might be nice to extend it such that if the 1st argument is a list then
> >the
> >first in the list which is set is returned, eg:
> >
> > $var = var_set(($_GET['var'], $_POST['var']), 'default');
>
> If that is the usage, I wou
It might be nice to extend it such that if the 1st argument is a list then the
first in the list which is set is returned, eg:
$var = var_set(($_GET['var'], $_POST['var']), 'default');
If that is the usage, I would suggest coalesce() to be consistent with
the same concept in SQL. And y
On Wed Apr 20 10:55 AM, Mark wrote:
>
> function varset($arr, $key, $default = '') { return (isset($arr[$key])
> ? $arr[$key] : $default); }
>
> where the call would be:
> $var = varset($_GET, 'var');
>
> I personally like both ways...
> My proposal is to make this function a core php function
On Wed, Apr 20, 2011 at 05:19:36PM +0200, Mark wrote:
> > If is is a language element (like isset()) then you can avoid this problem.
> >
>
> Could you explain that a bit more?
It looks like a function but is not:
http://uk3.php.net/manual/en/function.isset.php
> > It might be nice to
On Wed, Apr 20, 2011 at 5:12 PM, Alain Williams wrote:
> On Wed, Apr 20, 2011 at 04:55:00PM +0200, Mark wrote:
> > Hi,
> >
> > This proposal is for the often called line like this:
> > $var = isset($_GET['var']) ? $_GET['var'] : '';
> >
> > Only a shorter and imho a cleaner solution to get the sa
On Wed, Apr 20, 2011 at 04:55:00PM +0200, Mark wrote:
> Hi,
>
> This proposal is for the often called line like this:
> $var = isset($_GET['var']) ? $_GET['var'] : '';
>
> Only a shorter and imho a cleaner solution to get the same:
> $var = varset($_GET['var']);
It should be called var_set() - b
Hi,
This proposal is for the often called line like this:
$var = isset($_GET['var']) ? $_GET['var'] : '';
Only a shorter and imho a cleaner solution to get the same:
$var = varset($_GET['var']);
The implementation for this in PHP code is this:
# Arg 1 = the variable to check for existence
# Arg
Thanx guys for the advices
Respect...
Ante
Marcus Boerger wrote:
Hello AnteD,
Friday, May 13, 2005, 1:29:36 PM, you wrote:
Hi guys...
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PH
Hello AnteD,
Friday, May 13, 2005, 1:29:36 PM, you wrote:
> Hi guys...
> Yes I know that this is a small function and yes I know it can be
> copy-paste with every new project you do but from the first day I've
> been using PHP until today this function follows me everywhere and I now
> that e
> > > Yes I know that this is a small function and yes I know it can be
copy-paste
> > > with every new project you do but from the first day I've been using
PHP
> > > until today this function follows me everywhere and I now that
everyone is
> > > using it one way or the other for debugging..
On Mon, 16 May 2005, Sean Coates wrote:
> AnteD wrote:
> > Yes I know that this is a small function and yes I know it can be copy-paste
> > with every new project you do but from the first day I've been using PHP
> > until today this function follows me everywhere and I now that everyone is
> > us
On Friday 13 May 2005 14:29, AnteD wrote:
> Hi guys...
>
> Yes I know that this is a small function and yes I know it can be
> copy-paste with every new project you do but from the first day I've
> been using PHP until today this function follows me everywhere and I now
> that everyone is using it
AnteD wrote:
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PHP until today this function follows me everywhere and I now
that everyone is using it one way or the other for debugging..
...
The
Hmm, it's no GOTO, but oddly enough we have virtually exactly the same
function and use it everywhere too. The only differences are we call ours
pre_r() and we add the following check against php_sapi_name() so that the
function behaves sanely when called from the cli:
function pre_r($mixed, $
Hi guys...
Yes I know that this is a small function and yes I know it can be
copy-paste with every new project you do but from the first day I've
been using PHP until today this function follows me everywhere and I now
that everyone is using it one way or the other for debugging..
the probl
Hello,
yes ? no ? perhaps ? something ? :-)
- Original Message -
From: "Frédéric LECOINTRE" <[EMAIL PROTECTED]>
To:
Sent: Friday, February 25, 2005 5:12 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello,
|
| After tests, I did'nt n
ECTED]>; "Marcus Boerger" <[EMAIL PROTECTED]>
Cc:
Sent: Tuesday, February 22, 2005 3:20 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello all,
|
| thanks John for help
|
| so here, http://php-dev.burnweb.net.
| there's new diff to avoid unexpected
"John Coggeshall" <[EMAIL PROTECTED]>
To: "Marcus Boerger" <[EMAIL PROTECTED]>
Cc: "Frédéric LECOINTRE" <[EMAIL PROTECTED]>;
Sent: Monday, February 21, 2005 11:45 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| On Mon, 2005-02-21 a
Hello Frédéric,
Monday, February 21, 2005, 1:56:01 PM, you wrote:
> Hello Marcus,
> | have you experimented with php_check_syntax() and temporairy streams?
> tell me if i'm wrong.
> I think it could be possible to use php_lint_script and do compiler read
> variable instead of file
> - set zend_
Hello Marcus,
| have you experimented with php_check_syntax() and temporairy streams?
tell me if i'm wrong.
I think it could be possible to use php_lint_script and do compiler read
variable instead of file
- set zend_file_handle->type = ZEND_HANDLE_STREAM
- define two functions for reader and clo
right thing for Alan's idea. any suggestion ?)
> perhaps, use an alternative simple scanner like PHP_Parser would be a
> reasonable solution
> fred
> - Original Message -
> From: "Marcus Boerger" <[EMAIL PROTECTED]>
> To: &q
red
- Original Message -
From: "Marcus Boerger" <[EMAIL PROTECTED]>
To: "val khokhlov" <[EMAIL PROTECTED]>
Cc:
Sent: Sunday, February 20, 2005 6:05 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hello val,
|
| Sunday, February 20, 200
Hello val,
Sunday, February 20, 2005, 5:59:21 PM, you wrote:
> Hello Marcus,
> Sunday, February 20, 2005, 6:32:57 AM, you wrote:
MB>> what happend to defines (when redefining)
>define() is called at run-time, as far as i saw, so there should be no
> problems with it
MB>> and what happe
Hello Marcus,
Sunday, February 20, 2005, 6:32:57 AM, you wrote:
MB> what happend to defines (when redefining)
define() is called at run-time, as far as i saw, so there should be no
problems with it
MB> and what happens to __autoload()?
well, i never used it myself, so i've never te
--
> From: "Johannes Schlueter" <[EMAIL PROTECTED]>
> To:
> Sent: Friday, February 18, 2005 1:17 PM
> Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
> | Hi Fred,
> |
> | this patch doesn't just check wether the string has th
I guess swapping out the compiler and executer globals before /after the
compile call wont work?
egs = executor_globals
cgs = compiler_globals
compile_string / file etc.
efree(executor_globals);
efree(compiler_globals);
executor_globals = egs;
compiler_globals = cgs;
obviously if this is the ca
;,$foo[0].bar))
and avoid regexp ( good example in Smarty_Compiler.class.php#144-164 with
limitations)
fred
- Original Message -
From: "Johannes Schlueter" <[EMAIL PROTECTED]>
To:
Sent: Friday, February 18, 2005 1:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_synt
>> Is there possibilty to run syntax check only with compil_string in
>> zend_language_scanner.c (or something else) instead of removing the
>> introduced code?
>
> No. At least I don't know a how (but I don't know everything about the
> engine) The only thing I currently can think of is using t
Hi,
FrÃdÃric LECOINTRE wrote:
> oups ... well.
>
> php_check_syntax works fine with zend_compile_file. so what's the
No, it doesn't work fine, too :-)
http://bugs.php.net/bug.php?id=27406
But I didn't know the problem either when reading your patch where I
stumbled over the compile_string() call
ith compil_string in
zend_language_scanner.c (or something else) instead of removing the
introduced code?
fred
- Original Message -
From: "Johannes Schlueter" <[EMAIL PROTECTED]>
To:
Sent: Friday, February 18, 2005 1:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_stri
Hello Johannes,
Friday, February 18, 2005, 2:17:12 PM, you wrote:
JS> this patch doesn't just check wether the string has the right syntax but
JS> also compiles it and registers it's functions and classes in the relevant
JS> tables.
well, they need to add this code to avoid it:
n
ompil_string in
zend_language_scanner.c (or something else) instead of removing the
introduced code?
fred
- Original Message -
From: "Johannes Schlueter" <[EMAIL PROTECTED]>
To:
Sent: Friday, February 18, 2005 1:17 PM
Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
| Hi Fr
; <[EMAIL PROTECTED]>
> Cc:
> Sent: Friday, February 18, 2005 9:25 AM
> Subject: Re: [PHP-DEV] function proposal - php_check_syntax_string
>
>
> | Hello FrÃdÃric,
> |
> | do you have some c code you can post here as a .txt attachment or as a
> link?
> |
&
Hello Marcus,
Based on 5.0.3 source distribution, inspired of parsekit_compile_string
fred
- Original Message -
From: "Marcus Boerger" <[EMAIL PROTECTED]>
To: "Frédéric LECOINTRE" <[EMAIL PROTECTED]>
Cc:
Sent: Friday, February 18, 2005 9:25 AM
Subject:
Hello Frédéric,
do you have some c code you can post here as a .txt attachment or as a link?
regards
marcus
Friday, February 18, 2005, 4:41:06 AM, you wrote:
> hi all,
> to check syntax of pieces of code and to avoid wild regular expressions, i
> wrote this:
> proto bool php_check_syntax_stri
hi all,
to check syntax of pieces of code and to avoid wild regular expressions, i
wrote this:
proto bool php_check_syntax_string(string string [, &$error_message])
like php_check_syntax but on string
it will be useful for applications who have to store valid code like smarty,
...
is it possible
> Intresting for users that need such functions on several places in code
and in
> this case better as regexp in PHP itself. Why not take this ideas and put
> together into ext/html(format)?
>
I agree with the statement that functions like these (and nl2br() itself)
don't really belong in the PHP c
On Sunday 07 March 2004 21:58, Stefan Walk wrote:
> On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote:
> > I wrote this very simple function (modification from nl2br actually) to
> > convert newlines to well formatted HTML paragraphs instead of line
> > breaks, allowing bette
On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote:
> I wrote this very simple function (modification from nl2br actually) to
> convert newlines to well formatted HTML paragraphs instead of line
> breaks, allowing better formatting of a dynamic output. It's not the
> most p
On Sun, Mar 07, 2004 at 01:07:08PM -0500, Louis-Philippe Huberdeau wrote :
> /* {{{ proto string nl2p(string str)
>Converts newlines to HTML paragraphs for standard compliance */
I'm not to judge whether this goes in or not, however using
paragraphs is not more standard compliance tha
I wrote this very simple function (modification from nl2br actually) to
convert newlines to well formatted HTML paragraphs instead of line
breaks, allowing better formatting of a dynamic output. It's not the
most perfect piece of code ever written, but it works and it can be
quite useful.
The
52 matches
Mail list logo