Stanislav Malyshev wrote:
DB I do not know Java. In Perl, namespaces exist, so it's a
DB completely different ballgame. But even still, it's not the
DB responsibility of the user to know the inner workings of a
DB module or package in Perl.
If we talking about how to quick hack PHP
Stanislav Malyshev wrote:
SSB Basically, I think we should postpone fixing all of this for the
SSB ZE2-version of PHP, so we can do it proper.
I think this could be done without waiting for ZE2. ZE1 has everything
that is needed for this, if only you do not insist on having keyword for
Daniel Beckham wrote:
- Original Message -
From: Stanislav Malyshev [EMAIL PROTECTED]
To: Daniel Beckham [EMAIL PROTECTED]
Cc: php-dev [EMAIL PROTECTED]
Sent: Saturday, October 20, 2001 4:58 PM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function
SSB Basically, I think we should postpone fixing all of this for the
SSB ZE2-version of PHP, so we can do it proper.
I think this could be done without waiting for ZE2. ZE1 has everything
that is needed for this, if only you do not insist on having keyword for
it but it is OK with you to use
DB I do not know Java. In Perl, namespaces exist, so it's a
DB completely different ballgame. But even still, it's not the
DB responsibility of the user to know the inner workings of a
DB module or package in Perl.
If we talking about how to quick hack PHP engine so that it would suit
]
To: Daniel Beckham [EMAIL PROTECTED]
Cc: Brian Moon [EMAIL PROTECTED]; Edin Kadribasic
[EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Sunday, October 21, 2001 3:34 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
Yeah, ok, but that's what I'm getting
[EMAIL PROTECTED]
To: Brian Moon [EMAIL PROTECTED]
Cc: Edin Kadribasic [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, October 20, 2001 8:42 PM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
At 19:11 19-10-01, Brian Moon wrote:
- Even
Message -
From: Stanislav Malyshev [EMAIL PROTECTED]
To: Daniel Beckham [EMAIL PROTECTED]
Cc: php-dev [EMAIL PROTECTED]
Sent: Sunday, October 21, 2001 5:12 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
DB I do not know Java. In Perl, namespaces
- Original Message -
From: Zeev Suraski [EMAIL PROTECTED]
To: Stanislav Malyshev [EMAIL PROTECTED]
Cc: Daniel Beckham [EMAIL PROTECTED]; php-dev
[EMAIL PROTECTED]
Sent: Sunday, October 21, 2001 5:21 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function
DB My argument is that some functionality similar to a C #ifdef and
DB #ifndef is needed. Neither the include_once() nor the if/endif
Tell me how, for example, Java or Perl programmers manage to live without
ifdefs.
DB I already pointed out why include_once() is bad. You place the
DB
BM An E_NOTICE is raised at runtime. I know many people ignore
BM these, but it is there.
That's like saying I know nobody will hear the fire alarm, because I have
switched it off, but I'll still press the alarm button and consider it to
be the proper way to report the fire.
--
Stanislav
At 23:58 20-10-01, Stanislav Malyshev wrote:
DB My argument is that some functionality similar to a C #ifdef and
DB #ifndef is needed. Neither the include_once() nor the if/endif
Tell me how, for example, Java or Perl programmers manage to live without
ifdefs.
At least as far as Java is
At 19:11 19-10-01, Brian Moon wrote:
- Even with no protection at all, function redefinitions will not be
reported. That's kind of ugly.
An E_NOTICE is raised at runtime. I know many people ignore these, but it
is there.
So basically, your existing code base will now be issuing tons of
- Original Message -
From: Zeev Suraski [EMAIL PROTECTED]
To: Brian Moon [EMAIL PROTECTED]
Cc: Edin Kadribasic [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Saturday, October 20, 2001 8:42 PM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
At 19:11 19-10-01
DB where people were attempting to actually redefine a function
DB name. Brian's patch allows the compiler to encounter the same
DB function in the same file on the same line and only give a
DB notice instead of a fatal error. It's not the most elegant
Which is not backward-compatible with how
DB Essentially, to answer your question. include_once() is a very
DB poor way to write modular code that will be used across
DB different projects and across different developers. You are
Why?
DB placing the responsibility of not accidentally redefining
DB function names on the user of the
Stanislav, he does have a point in that it would be a good idea to be able
to create an include file which protected itself from multiple exclusion
instead of relying on the user to use the file correctly. That's what he
means by bad style. There could be cases where you created a system where
RL Stanislav, he does have a point in that it would be a good idea to be able
RL to create an include file which protected itself from multiple exclusion
RL instead of relying on the user to use the file correctly. That's what he
I'm these minutes finish to write a proposal which is meant to
Since you can no longer do:
if(!defined(_FOO_INC)):
define('_FOO_INC',1);
...
endif;
to protect a file from multiple inclusion within the file itself, some
This is still a valid construct. I could find nothing in the discussion that
would indicate otherwise. The only thing that
It is valid in the sense that the code would not be executed the second
time, but it isn't valid for preventing multiple function definitions
inside that block. ie. no conditional function definitions.
-Rasmus
On Fri, 19 Oct 2001, Edin Kadribasic wrote:
Since you can no longer do:
I guess I do not understand. The following example works just fine in PHP
4.1.0RC1:
test.php
=
?php
include 'testlib.php';
include 'testlib.php';
test();
?
testlib.php
==
?php
if (!defined('_TESTLIB_PHP')) {
define ('_TESTLIB_PHP', 1);
function test() {
print Function test()\n;
I guess I do not understand. The following example works just fine in PHP
4.1.0RC1:
test.php
=
?php
include 'testlib.php';
include 'testlib.php';
test();
?
testlib.php
==
?php
if (!defined('_TESTLIB_PHP')) {
define ('_TESTLIB_PHP', 1);
function test() {
print
I guess I do not understand. The following example works just fine in
PHP
4.1.0RC1:
test.php
=
?php
include 'testlib.php';
include 'testlib.php';
test();
?
testlib.php
==
?php
if (!defined('_TESTLIB_PHP')) {
define ('_TESTLIB_PHP', 1);
function test()
PROTECTED]; PHP
Development [EMAIL PROTECTED]
Sent: Friday, October 19, 2001 5:22 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
I guess I do not understand. The following example works just fine in PHP
4.1.0RC1:
test.php
=
?php
include 'testlib.php
[EMAIL PROTECTED]; Daniel Beckham
[EMAIL PROTECTED]; Brian Moon [EMAIL PROTECTED]; PHP
Development [EMAIL PROTECTED]
Sent: Friday, October 19, 2001 5:22 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
I guess I do not understand. The following example
AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
DB Essentially, to answer your question. include_once() is a very
DB poor way to write modular code that will be used across
DB different projects and across different developers. You are
Why?
DB
-
From: Rasmus Lerdorf [EMAIL PROTECTED]
To: Stanislav Malyshev [EMAIL PROTECTED]
Cc: Daniel Beckham [EMAIL PROTECTED]; Brian Moon
[EMAIL PROTECTED]; PHP Development [EMAIL PROTECTED]
Sent: Friday, October 19, 2001 3:15 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function
[EMAIL PROTECTED]; Brian Moon
[EMAIL PROTECTED]; PHP Development [EMAIL PROTECTED]
Sent: Friday, October 19, 2001 3:43 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
RL which is which is not great. It would be nice if you could trigger
the
RL
- Original Message -
From: Stanislav Malyshev [EMAIL PROTECTED]
To: Daniel Beckham [EMAIL PROTECTED]
Cc: Brian Moon [EMAIL PROTECTED]; PHP Development
[EMAIL PROTECTED]
Sent: Friday, October 19, 2001 2:45 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function
By all means, if you have a decent proposal that doesn't involve
exclusively
using include_once() or if/endif everywhere possible, we would love to
hear
it.
I'm just curious: what's wrong with using if/endif where include_once isn't
good enough?
--
PHP Development Mailing List
]
To: Daniel Beckham [EMAIL PROTECTED]
Cc: PHP Development [EMAIL PROTECTED]
Sent: Friday, October 19, 2001 9:27 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
By all means, if you have a decent proposal that doesn't involve
exclusively
using
] New zend_compile.c to solve all of the duplicate
function problems
By all means, if you have a decent proposal that doesn't involve
exclusively
using include_once() or if/endif everywhere possible, we would love to
hear
it.
I'm just curious: what's wrong with using if/endif where
The problem is backward compatiblity. That is the biggest thing at stake
here. Daniel and I are a bit skewed as we have over 1000 files full of
code
that start with something like:
if(defined(_FILE_NAME)) return;
define(_FILE_NAME, 1);
This was our solution _before_ include_once ever
Nope, Edin was right. It's valid in both senses.
Zeev
At 11:50 19-10-01, Rasmus Lerdorf wrote:
It is valid in the sense that the code would not be executed the second
time, but it isn't valid for preventing multiple function definitions
inside that block. ie. no conditional function
Clearly, you shouldn't be getting function redefinitions with the way you
wrote the code. I'm not sure why Rasmus is getting them, Rasmus - are you
sure you're running an exact copypaste of his code?
Basically, unless the functions are in the top-level scope, there won't be
any problems,
At 16:33 19-10-01, Daniel Beckham wrote:
The reason it works inside of an if/endif is because the code is never
pre-compiled and only executed during run time. For large code libraries,
like we have here at our office, this would cause a performance decrease.
The code is precompiled alright.
At 17:47 19-10-01, Brian Moon wrote:
It is in fact slightly faster. I created a script with 10 functions
like:
function foo1() { echo 1; }
It was 3.3 seconds to 3.6 seconds in favor of the patched code.
That's like comparing apples and palm trees though, because the behavior
was
- Even with no protection at all, function redefinitions will not be
reported. That's kind of ugly.
An E_NOTICE is raised at runtime. I know many people ignore these, but it
is there.
Brian.
--
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
file ee:
?
if(!defined(_FOO_INC)):
define('_FOO_INC',1);
function foo() {
echo Hello World\n;
}
endif;
?
file ee1:
?
include 'ee';
include 'ee';
foo();
?
10:11am rasmus:~ php ee1
X-Powered-By: PHP/4.0.8-dev
Content-type: text/html
br /
If I put quotes around the string it works:
if(!defined('_FOO_INC')):
file ee:
?
if(!defined(_FOO_INC)):
define('_FOO_INC',1);
function foo() {
echo Hello World\n;
}
endif;
?
file ee1:
?
include 'ee';
include 'ee';
foo();
?
10:11am rasmus:~ php ee1
X-Powered-By:
ah, duh.. Right.
On Fri, 19 Oct 2001, Edin Kadribasic wrote:
If I put quotes around the string it works:
if(!defined('_FOO_INC')):
file ee:
?
if(!defined(_FOO_INC)):
define('_FOO_INC',1);
function foo() {
echo Hello World\n;
}
endif;
?
file ee1:
?
include 'ee';
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
At 16:33 19-10-01, Daniel Beckham wrote:
The reason it works inside of an if/endif is because the code is never
pre-compiled and only executed during run time. For large code
libraries,
like we have
On Thu, 18 Oct 2001, Brian Moon wrote:
Ok,
I played with the code in zend_compile.c last night and came up with this
solution. The attached file will only issue a NOTICE for duplicate
functions from the same line and file. It will still issue an ERROR for
duplicate functions of a
See bug 13616.
Brian.
- Original Message -
From: Stanislav Malyshev [EMAIL PROTECTED]
To: Brian Moon [EMAIL PROTECTED]
Cc: PHP Development [EMAIL PROTECTED]
Sent: Thursday, October 18, 2001 10:01 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function
to solve all of the duplicate
function problems
On Thu, 18 Oct 2001, Brian Moon wrote:
Ok,
I played with the code in zend_compile.c last night and came up with
this
solution. The attached file will only issue a NOTICE for duplicate
functions from the same line and file. It will still issue
BM See bug 13616.
I see. I think you should really use include_once - I just do not see the
reason why not to do it and why patch the code instead. Could you explain?
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED] http://www.zend.com/ +972-3-6139665 ext.115
--
PHP
: Thursday, October 18, 2001 10:14 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
BM See bug 13616.
I see. I think you should really use include_once - I just do not see the
reason why not to do it and why patch the code instead. Could you explain
BM include_once as i have already stated is useless inside of a
BM function. Variables in the file are not global. And, I cannot
Why include_once inside a function is different from include inside a
function?
BM include it again with include_once. The example I gave is not
BM acurate to how
BM include_once as i have already stated is useless inside of a
BM function. Variables in the file are not global. And, I cannot
Why include_once inside a function is different from include inside a
function?
Because once include_once is used on a file, include_once won't include the
file
: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
On Thu, 18 Oct 2001, Brian Moon wrote:
Ok,
I played with the code in zend_compile.c last night and came up with
this
solution. The attached file will only issue a NOTICE for duplicate
functions
BM It is not a matter of the functions. If everything were a function or class
BM ( like Java ) this would not be an issue. But, we have variables and such
BM in these files that prevent us from be able to trust include_once.
Ah. Now I see what you mean. Then the solution would be or use
to solve all of the duplicate
function problems
BM See bug 13616.
I see. I think you should really use include_once - I just do not see the
reason why not to do it and why patch the code instead. Could you explain?
--
Stanislav Malyshev, Zend Products Engineer
[EMAIL PROTECTED] http
- Original Message -
From: Stanislav Malyshev [EMAIL PROTECTED]
To: Brian Moon [EMAIL PROTECTED]
Cc: PHP Development [EMAIL PROTECTED]
Sent: Thursday, October 18, 2001 10:53 AM
Subject: Re: [PHP-DEV] New zend_compile.c to solve all of the duplicate
function problems
BM And my fix
53 matches
Mail list logo