Jump to content

netcarver

PW-Moderators
  • Posts

    2,174
  • Joined

  • Last visited

  • Days Won

    44

Posts posted by netcarver

  1. @Ralf

    Please would you try out the new, ng branch, and let me know how it goes.

    Spoiler
    Various Updates
    * PW 3+
    * PHP 7.2+
    * Modern array syntax
    * Fix: Name in field type list
    * Fix: Incorrect format selection
    * Feat: Add appropriate placeholder based on format
    * Feat: Add title attr from format description
    * Chore: More consistent strings
    * Chore: More consistent functions
    * Chore: More type hinting

    The ng branch on github.
    Direct download link for the ng branch zip.

    Not for production sites at the moment.

    Thank you.

  2. Hi @psy

    1. Have you got anything on the site that hooks into session methods?
    2. Have you had a search for any similar open or closed issues on the processwire-issues repo? There might be something there that could help.
    3. You could try turning off unknown message method exceptions via the little-known "disableUnknownMethodException" config variable - this might get you through the line doing the redirect, but it will totally obscure the real issue here.

    Hopefully others might have better suggestions, or @ryan might take a look.

  3. Hi @psy are you able to compare all the headers being sent by postman with all the headers you are going over from WireHTTP()? Perhaps something that's needed is missing.

    Also, did you try changing "content-type" -> "Content-Type" ? Might be that the endpoint is being picky about case-sensitivity. Also, do you need to specify the character encoding?  Something like "Content-Type" => "application/json; charset=utf-8"?

    Another thing to look at is the encoding flags for the json data. Might be that the way postman is encoding the payload is slightly different to the way PHP is encoding it. I'd dump the output of the json_encode() and carefully compare it to the format being sent from Postman (if it's possible to see it.)

  4. If you put this in your template file, just before you try outputting the address, what do you get? (Remove the PHP tags if you need to, and/or add nl2br() around the output to make it prettier)...

    <?php
    $country = 'DE';
    $format  = var_export(StreetAddress::getFormat($country), true);
    echo "Format for $country is [$format]";
    ?>

    Here's what I get locally (run from the command line though)
    image.png.ba0271090141a1cd792d7f2a7236553f.png

    The other thing to check is that the address you are formatting is actually tagged up with Germany as the destination country?

     

  5. @clemens Thank you for the +ve feedback. I'm not sure I understand the issue you are having based on your description, but you can easily override the output formats, which are pulled from Google's LibAddressInput project, by simply editing the example.formats_overrides.php file in the FieldtypeStreetAddress/ directory. You'll need to look at the "Reading the JSON" section of the LibAddressInput project documentation to see what each of the fields is. In case it's not obvious, "%n" is a newline.

    This might allow you to do what you are after but, if not, please post again.

    Here's what one of my local DE-based addresses looks like - with no changes to the defaults from Google. This seems to have things in ZIP CITY order...
    image.png.82d89ad5a2e15d4f7d996f31a2c9c0e2.png

  6. Hello,

    Is anyone using static analysis tools like Psalm/PHPStan and/or Semgrep on PW here?  If so, could you share a little wisdom with tricks/config that can help get started with them on a PW project? I've got a few semgrep rules worked out, and they seem to work well, but I'm struggling with the huge number of detections when using Psalm vs a PW project.  I guess I could just baseline the current state of play and take things from there, but wonder if there is anything else I should be doing to make Psalm more aware of PW itself.

    Thanks for reading.

    • Like 2
  7. @eydun Thank you for the post - doesn't look like this is PHP 8.1 related - will take a look and get back to you.

    Updated to add: Postmark have changed their Status API - something this module uses - and that is causing the breakage you are seeing above.

  8. Not sure how rockshell works, but I find SSH's config file very helpful. Perhaps something like this in ~/.ssh/config this could help here (if not already in use)?

    Host *
        IdentitiesOnly=yes
        
    Host staging
        IdentityFile ~/.ssh/<YOUR STAGING KEY FILE>
        #User bernhard ## Uncomment and change if server account doesn't match your local name
        #Port 22 ## Uncomment and change if server not listening on port 22

    Any time an ssh connection is attempted to staging, it should use the correct identity file (or files if you add more IdentityFile lines,) rather than have SSH try all your keyfiles until the server complains.

×
×
  • Create New...