Page MenuHomePhabricator

Helper method for max text field length and validate alias length
ClosedPublic

Authored by lpriestley on Nov 4 2015, 6:01 PM.
Tags
None
Referenced Files
F14029066: D14403.id34800.diff
Fri, Nov 8, 7:09 PM
F14021527: D14403.diff
Wed, Nov 6, 9:47 AM
F13996954: D14403.id34795.diff
Thu, Oct 24, 1:20 AM
F13984754: D14403.diff
Sun, Oct 20, 3:41 PM
Unknown Object (File)
Sun, Oct 13, 10:51 PM
Unknown Object (File)
Sun, Oct 13, 10:25 PM
Unknown Object (File)
Oct 7 2024, 2:20 AM
Unknown Object (File)
Oct 7 2024, 12:08 AM
Subscribers

Details

Summary

Ref T8992, Validate alias text field length.

Test Plan

Create Phurl with alias of more than 64 characters. Get error. Reduce length of alias to successfully save Phurl.

Diff Detail

Repository
rP Phabricator
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

lpriestley retitled this revision from to Helper method for max text field length and validate alias length.
lpriestley updated this object.
lpriestley edited the test plan for this revision. (Show Details)
lpriestley added a reviewer: epriestley.
lpriestley edited edge metadata.

Copy/pasta goof

One possible issue?

src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
2209

If there are no transactions, I think this might fatal -- last($xactions) will return null or false and then have ->getNewValue() called on it?

You could probably test this by subscribing/unsubscribing from a Phurl -- I think it will fatal here (maybe).

src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
2209

The way I used this helper, I guess it's called only once you've been bucketed into a switch case of a certain transaction type, so I think there will always be a xaction the way it is now, so I don't think it will fatal as is. But I guess there's no guarantee that's how the method will be used. I'll move the variable back down to after the first if.

lpriestley edited edge metadata.

Foreseeing a possibly empty xaction array.

epriestley edited edge metadata.
epriestley added inline comments.
src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php
2213

I think we can still get here with empty $xactions if the current field value is too long and we aren't touching it. This is impossible to reach in the UI, and probably impossible to reach period (there's no way to make the current field value too long because the database only stores 64 characters) but might be possible for future callers to reach it some day.

This revision is now accepted and ready to land.Nov 4 2015, 6:10 PM
lpriestley edited edge metadata.

Cleaning up $xactions validation order.

This revision was automatically updated to reflect the committed changes.