Commit graph

15 commits

Author SHA1 Message Date
Reedy
32a4629b3d HtmlForm: Null coalescence in trim() calls
Bug: T312305
Bug: T311572
Bug: T311571
Bug: T311578
Change-Id: I89a135d271c981c011360098ca5e98dc5a47ae37
2022-07-16 02:49:14 +01:00
Tim Starling
ca71e69fc6 Try not to discard Excimer timeout exceptions
Don't catch and discard exceptions from the RequestTimeout library,
except when the exception is properly handled and the code seems to be
trying to wrap things up.

In most cases the exception is rethrown. Ideally it should instead be
done by narrowing the catch, and this was feasible in a few cases. But
sometimes the exception being caught is an instance of the base class
(notably DateTime::__construct()). Often Exception is the root of the
hierarchy of exceptions being thrown and so is the obvious catch-all.

Notes on specific callers:

* In the case of ResourceLoader::respond(), exceptions were caught for API
  correctness, but processing continued. I added an outer try block for
  timeout handling so that termination would be more prompt.
* In LCStoreCDB the Exception being caught was Cdb\Exception not
  \Exception. I added an alias to avoid confusion.
* In ImageGallery I added a special exception class.
* In Message::__toString() the rationale for catching disappears
  in PHP 7.4.0+, so I added a PHP version check.
* In PoolCounterRedis, let the shutdown function do its thing, but
  rethrow the exception for logging.

Change-Id: I4c3770b9efc76a1ce42ed9f59329c36de04d657c
2022-02-02 16:27:44 +11:00
Thiemo Kreuz
947a8cfc00 Use ?? instead of isset/array_key_exists where possible
This patch touches all uncontroversial (I hope) places where a chain
of isset(), array_key_exist() and the ternary ?: operator can be
replaced with the much shorter ?? feature from PHP 7.

?? does the same. It checks if the element before the ?? is set and
not null. When this check fails, the element after the ?? is used.

Change-Id: Id612e2782ae928164b26b6f0de676c6c7d8302f3
2021-02-10 20:32:25 +01:00
STran
55ef87aa9c Pass along the disabled/readonly attributes to HTMLDateTimeField
Bug: T273335
Change-Id: I57fca9666cc013fd8fa2b64f09218da8e7e950c6
2021-02-02 07:24:01 -08:00
Thiemo Kreuz
fd7363a1e1 Fix broken PHPDoc comments that don't start with /**
Change-Id: I8db56ff0f73873864dde260e51adcd729aa74e94
2020-07-23 16:09:41 +00:00
Nikki Nikkhoui
6b0e9eafe1 HTML Classes stability annotations
Add stability annotations for HTML classes.

Bug: T247862
Change-Id: I4dad7b98213ceceb8c04b24e5d52e6fecadb3538
2020-07-13 14:54:28 +02:00
Bartosz Dziewoński
2d382b198f HTMLDateTimeField: Load styles for PHP widget
Bug: T220601
Change-Id: Id507459fea434bd6eb1af2bb6d1163c138a3a9d1
2019-04-11 00:50:11 +02:00
jdlrobson
7a52d71e2a Use DateInputWidget for date inputs which do not need time
For those that still need the precision of time, the
DateTimeInputWidget can be used.

Bug: T107069
Change-Id: I2e0b0168b53594760c2630dc4ecd4e6af7404a7c
2019-03-27 21:59:10 +00:00
Bartosz Dziewoński
205231d7da HTMLDateTimeField: Remove hacks for HTML5 form validation attributes
No longer needed after I08244addcf9b6eb96137895f28e7b750914fef5c.
Also remove datetime.js from mediawiki.htmlform module.

Change-Id: Ic2410c689de3f70f573fa1c71456e6d3f334f80b
2017-01-10 22:53:33 +00:00
jenkins-bot
d05562d0db Merge "HTMLDateTimeField: Fix 'placeholder' attribute handling" 2016-11-25 18:58:48 +00:00
Bartosz Dziewoński
ce247df6b5 HTMLDateTimeField: Fix 'placeholder' attribute handling
Parent class HTMLTextField handles this specially and we have to match it.

Change-Id: Ibff3caba2a58c2bcbfb342789aae9f0939b7687f
2016-11-24 16:13:40 +01:00
Brad Jorsch
7fdbe15fb6 HTMLForm: Allow returning Message objects from HTMLFormField::validate()
It mostly already worked. HTMLForm::trySubmit() needed a little
adjustment to handle things properly.

Change-Id: Ibb17bb61ac0b2d41953249980bc2f23b8a3ae5b6
2016-11-14 13:25:14 -05:00
addshore
63dd31cd31 Add access modifiers to htmlform classes
Change-Id: Id8c0f0676b3200993af3cec493efc99839211bcc
2016-11-04 11:40:42 +01:00
Brad Jorsch
627148d2bb HTMLDateTimeField: Properly handle empty input
i.e. don't parse it as "now" in date or datetime mode.

Bug: T148200
Change-Id: I5a3839540222160e8d7376b5b961147c41d48885
2016-10-14 12:39:31 -04:00
Brad Jorsch
12bdc84219 HTMLForm: Add HTMLDateTimeField
And to do that, an OOUI PHP widget for
mw.widgets.datetime.DateTimeInputWidget too.

Bug: T146340
Change-Id: Iaa8b5892b6c3a1f3698cef59684cc3cdc9d483ea
2016-09-26 12:08:56 -04:00