Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.1.0

Your comment was added to the bug successfully.
Bug #16567 Deprecated: Assigning the return value & Deprecated: Function eregi()
Submitted: 2009-09-03 02:27 UTC
From: mrlight Assigned: doconnor
Status: Closed Package: XML_Parser2
PHP Version: 5.3.0 OS: All
Roadmaps: (Not assigned)    
Subscription  


 [2009-09-03 02:27 UTC] mrlight (Nikola Vignjevic)
Description: ------------ Deprecated: Assigning the return value of new by reference is deprecated on line 616 Deprecated: Function eregi() is deprecated in on line 420

Comments

 [2009-09-03 02:33 UTC] mrlight (Nikola Vignjevic)
-Operating System: OS X +Operating System: All
 [2009-09-14 09:11 UTC] doconnor (Daniel O'Connor)
-Assigned To: +Assigned To: ashnazg
 [2009-09-14 19:12 UTC] cweiske (Christian Weiske)
eregi can be fixed, new-by-ref not - because we need to keep backward compatibility to php4.
 [2009-09-24 03:04 UTC] ashnazg (Chuck Burgess)
-Status: Assigned +Status: Open
 [2010-02-18 08:19 UTC] noodlesnz (Nick Le Mouton)
Hasn't php4 reached its EOL? Why do people still bother writing code for it? Is it not possible to create a new version of XML Parser that requires PHP 5.0+?
 [2010-03-03 03:29 UTC] skyrunner (Steven Davis)
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...
 [2010-05-05 21:08 UTC] zigo (Thomas Goirand)
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-05-26 01:11 UTC] caribou (Pascal Corpet)
@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-26 06:32 UTC] zigo (Thomas Goirand)
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-27 03:48 UTC] caribou (Pascal Corpet)
@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-27 14:10 UTC] zigo (Thomas Goirand)
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.
 [2010-05-28 01:37 UTC] caribou (Pascal Corpet)
Correcting the erig is easy: preg_match function works in both PHP4 and PHP 5.3. The patch I sumbitted earlier takes care of this warning.
 [2010-06-01 23:12 UTC] caribou (Pascal Corpet)
@zigo, I didn't notice you wrote "if you like" in your comment. I would very much enjoy a way of fixing this issue on debian; so if you can contact them, please do.
 [2010-06-10 08:47 UTC] zigo (Thomas Goirand)
FYI: I tried to get the pkg-php team involved, but it didn't work, as you can see.
 [2010-08-31 22:41 UTC] zigo (Thomas Goirand)
A patch has been sent to this bug tracker quite a long time ago. Why isn't it applied to the package? Please fix this issue. Thomas
 [2010-10-26 01:20 UTC] jk3us (Jay Knight)
I just saw that a new version has come out (1.3.4), but it looks like this problem is still present.
 [2011-03-27 00:16 UTC] dufuz (Helgi Þormar Þorbjörnsson)
Just a heads up, the eregi usage has already been discontinued in this package, in 1.3.3: http://svn.php.net/viewvc/pear/packages/XML_Parser/trunk/Parser.php? r1=266395&r2=302733 Was done as a part of a fix for Bug #17725
 [2011-03-27 09:47 UTC] zigo (Thomas Goirand)
And has the return value been fixed as well? I did fix it in my Debian package too, so I wont upgrade the SID package to the latest version of XML_Parser until the return as reference is fixed too. Thomas
 [2011-06-07 21:53 UTC] jk3us (Jay Knight)
Can't the same thing be done in PHP 4 without the return by reference? I'm not sure I see why it is done by reference in the first place. Unfortunately, I don't have PHP 4 to test this out with.
 [2012-01-31 04:03 UTC] zigo_debian (Thomas Goirand)
Hi, Is there any update with this bug? I'm still carrying a patch in Debian to remove the return as reference, and it's been now quite a long time this bug entry has been opened. Please consider fixing ! I'm adding a new patch that has only the return as reference fix, since the ereg calls have been replaced by preg in the latest release. Cheers, Thomas Goirand (zigo)
 [2012-01-31 04:04 UTC] zigo_debian (Thomas Goirand)
 [2012-03-31 22:08 UTC] doconnor (Daniel O'Connor)
-Package: XML_Parser +Package: XML_Parser2
 [2012-03-31 22:08 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Closed -Assigned To: +Assigned To: doconnor
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.