Page MenuHomePhabricator

Unknown Error/MySQL errors
Open, Needs TriagePublic

Description

This is the message you get if you try to access erwin85 tools:

Unknown Error: There were MySQL errors at Thu, 14 Jul 2016 21:01:03 +00008192mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead/data/project/erwin85/public_html/inc/database.class.php467Array. It is possible that this tool won't work right now. If this error message persists please file a bug.

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJul 14 2016, 9:05 PM

It's the usual bug with the newer Ubuntu, I'm not sure how long we can use the old way

tools.erwin85@tools-bastion-03:~$ webservice stop
Stopping webservice
tools.erwin85@tools-bastion-03:~$ webservice start --release=precise
--release is deprecated and has no effect, using trusty...
Starting webservice.

Last time I was told the deprecation warning is a false alarm, but now it seems it really didn't have effect. Do you see any change?

'webservice precise-lighttpd start' works now, and it is running in precise now.

Note that we'll be winding down support for Ubuntu precise around end of 2016 / beginning of 2017 (announcement coming soon) so I'd reccomend upgrading.

Nemo_bis added a comment.EditedJul 18 2016, 3:38 PM

'webservice precise-lighttpd start' works now, and it is running in precise now.

Not for me:

tools.erwin85@tools-bastion-03:~$ webservice precise-lighttpd start
type must be one of  generic,tomcat,nodejs,lighttpd-precise,lighttpd-plain,uwsgi-plain,lighttpd,uwsgi-python

Maybe this did:

$ webservice lighttpd-precise start
Starting webservice.

Sorry, I meant 'lighttpd-precise' not precise-lighttpd.

Schnark added a subscriber: Schnark.Sep 1 2016, 8:56 AM

It's happening again.

I've done webservice lighttpd-precise start again, then started some work to switch to mysqli but I don't have time to finish (in particular to give mysqli_real_escape_string() the connection it expects as first argument) so I git stashed those changes.

Thanks nemo, it would be nice if someone finds the time to give you an hand updating the code. :)

Supernino added a comment.EditedSep 8 2016, 8:02 AM

'Related changes' tool seems stuck, doesn't show new edits since yesterday before 15:00 UTC http://tools.wmflabs.org/erwin85/relatedchanges.php

Can someone restart it?

Akoopal added a subscriber: Akoopal.

With the current project to phase out precise, this should get more focus.

scfc added a subscriber: scfc.Feb 9 2017, 3:15 AM

I first tried to silence the deprecation warning with error_reporting((E_ERROR|E_CORE_ERROR|E_ALL|E_COMPILE_ERROR) ^ E_DEPRECATED); in inc/webStart.inc.php (inspired by http://stackoverflow.com/a/21797209/913663), but that did not work because inc/errorhandler.inc.php calls set_error_handler() and thus effectively disables error_reporting() (cf. http://php.net/manual/en/function.set-error-handler.php):

error_reporting() settings will have no effect and your error handler will be called regardless - however you are still able to read the current value of error_reporting and act appropriately.

So I patched inc/errorhandler.inc.php:

diff --git a/inc/errorhandler.inc.php b/inc/errorhandler.inc.php
index 65fb965..7675149 100644
--- a/inc/errorhandler.inc.php
+++ b/inc/errorhandler.inc.php
@@ -101,6 +101,8 @@ function ErrorHandler($errno, $errstr, $errfile, $errline,  $errcontext)
 }
 
 if (error_reporting() != 0) {
-    set_error_handler('ErrorHandler');
+    # Added ", error_reporting() & ~E_DEPRECATED" as a temporary
+    # workaround for T140421.                      -- scfc, 2017-02-09
+    set_error_handler('ErrorHandler', error_reporting() & ~E_DEPRECATED);
 }    
 ?>

and restarted the webservice with Kubernetes by webservice stop && webservice --backend=kubernetes php5.6 start. This removed the "big" warning from http://tools.wmflabs.org/erwin85/relatedchanges.php and is intended to take off some steam before the March 6 deadline for Precise tools shutdown.

For example http://tools.wmflabs.org/erwin85/relatedchanges.php?lang=de&family=wikipedia&category=Krefeld&d=10&ignore=&submit=Submit showed warnings like "Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead. in /data/project/erwin85/public_html/relatedchanges.php on line 21". I've fixed those with perl -i -pwe 's!mysql_escape_string!mysql_real_escape_string!g;'.

NB: My patch does not fix the use of a deprecated PHP module, but merely hides the warnings; additionally, it may hide also deprecation warnings triggered by other PHP functions, so my patch should be reverted as soon as possible.

I'll submit pull requests for my changes.

scfc added a comment.Feb 9 2017, 8:01 AM

I had to switch from the Kubernetes backend to the (Trusty) grid with webservice stop && webservice --backend=gridengine lighttpd start because catanalyzer.php uses dot from the package graphviz which is only installed on execution nodes.

scfc added a comment.Feb 9 2017, 8:05 AM

… and I saved @Nemo_bis's work as branch pu/nemos-work – IMHO Git makes it easier to work with branches than with stashes: If you rebase a branch onto master (with conflicts), you can either fix the conflicts or git rebase --abort if you don't have the time. git stash pop with conflicts leaves the working directory dirty, leaves the commit on the stash and does not allow to easily undo the pop.