Bug #16567 [Com]: Deprecated: Assigning the return value & Deprecated: Function eregi()
| From: | thomas@goirand.fr | Date: | Thu, 27 May 2010 10:10:23 +0000 |
| Subject: | Bug #16567 [Com]: Deprecated: Assigning the return value & Deprecated: Function eregi() | ||
| References: | 1 | Groups: | php.pear.bugs |
| Request: | Send a blank email to pear-bugs+get-3810@lists.php.net to get a copy of this message | ||
Edit report at http://pear.php.net/bugs/bug.php?id=16567&edit=1
ID: 16567
Comment by: thomas@goirand.fr
Reported By: n dot vignjevic at nao-company dot com
Summary: Deprecated: Assigning the return value & Deprecated:
Function eregi()
Status: Open
Type: Bug
Package: XML_Parser
Operating System: All
Package Version: 1.3.2
PHP Version: 5.3.0
Roadmap Versions:
New Comment:
That might be correct for returning a value as reference. However,
testing against the PHP version for choosing eregi preg_match WILL work.
I will involve the Debian pkg-php-pear team if you like, so that they
can find a solution for the returning a reference issue.
Previous Comments:
------------------------------------------------------------------------
[2010-05-26 23:48:19] caribou
@zigo: I just tried the following.
file test2.php:
if (false)
$a =& new A();
file test.php:
error_reporting(E_ALL);
require_once 'test2.php';
I get a warning for deprecated return value of new.
In this case the warning is not for the function but for the use of "=&
new". So the patch I submit won't work. :-(
If you find a way, please tell me.
------------------------------------------------------------------------
[2010-05-26 02:32:31] zigo
That's absolutely wrong. A function that is not called will NOT
generate a warning before it's called. Why? Because you can create
function dynamically, so it would be wrong to display a warning. So your
argument doesn't work, and you can still change your code to use
preg_match instead of ereg.
Anyway, using ereg in PHP6 is not only deprecated and display a notice:
it will crash as the function has been removed. So, even if what you
pretend was right (it is not), then what would you prefer ? Be totally
incompatible with the new version, simply because you don't want a
warning in the antediluvian version? It doesn't make sense at all.
Please correct the current version of XML_Parser so that we don't have
to carry-on distribution specific patches (Debian, in my case), which
are a pain to maintain and that will be different in each distribution.
------------------------------------------------------------------------
[2010-05-25 21:11:35] caribou
@zigo : this is not possible because PHP will parse the wrongful code
anyhow and issue the warning (even if it will never be actually run)
------------------------------------------------------------------------
[2010-05-05 17:08:27] zigo
COME ON! You can't say "because of php 4, I can't make it compatible
with php 5.3". That's a non-sense.
If you really wish to continue to be compatible with php 4 (which I
think is useless pain), then make a test on the version of php you are
running. Something like this will do:
$regexp = "^testit\$";
if (version_compare( phpversion(), '5.3.0') >= 0){
$check_result = prereg_match( "/" . $regexp . "/i" , $myvar);
}else{
$check_result = eregi( $regexp , $myvar);
}
I'll send a patch file to you if I have time, but really, it's not hard
to do.
Thomas
------------------------------------------------------------------------
[2010-03-02 22:29:51] skyrunner
http://www.phpdeveloper.org/news/8235
http://us3.php.net/archive/2007.php
PHP 4 has been done for almost 3 years (July 13th, 2007) I would love
to see an updated version of XML_Parser so I can get rid of these
deprecation warnings that have been filling my logs. Please consider
this.
Is XML_Parser still under development? It seems surprising that these
deprecation warnings aren't mentioned more frequently in a google
search...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://pear.php.net/bugs/bug.php?id=16567
--
Edit this bug report at http://pear.php.net/bugs/bug.php?id=16567&edit=1