Site News: Blast from the Past – One Year Ago in PHP (07.16.2020)

Here's what was popular in the PHP community one year ago today:

PHP Internals News: Episode 62: Saner Numeric Strings

PHP Internals News: Episode 62: Saner Numeric Strings

In this episode of "PHP Internals News" I talk with George Peter Banyard (Website, Twitter, GitHub, GitLab) about an RFC that he has proposed to make PHP's numeric string handling less complicated.

The RSS feed for this podcast is https://derickrethans.nl/feed-phpinternalsnews.xml, you can download this episode's MP3 file, and it's available on Spotify and iTunes. There is a dedicated website: https://phpinternals.news

Transcript

Derick Rethans 0:17 Hi, I'm Derick, and this is PHP internals news, a weekly podcast dedicated to demystifying the development of the PHP language. This is Episode 62. Today I'm talking with George Peter Banyard about an RFC that he's proposing called saner numeric strings. Hello George, how are you this morning?

George Peter Banyard 0:36

How are you I'm doing fine. I'm George Peter Banyard. I work on PHP, and I'm currently employed by The Coding Machine to work on PHP.

Derick Rethans 0:46

I actually think I have a bug swatter from The Coding Machine, which is hilarious. Huh, I can't show you that okay of course in a podcast and not on TV. But yes, I think I got it in Paris at some point at a conference there, and it's been happily getting rid of flies in my living room. Anyway, that's not what we want to talk about here today, we want to talk about the RFC that is made, what is the problem that is RFC is hoping to address?

George Peter Banyard 1:09

PHP has the concept of numeric strings, which are strings which have like integers or floats encoded as a string. Mostly that would arrive when you have like a get request or post request and you take like the value of a form, which would be in a string. Issue is that PHP makes some kind of weird distinctions, and classifies numeric strings in three different categories mainly. So there are purely numeric strings, which are pure integers or pure floats, which can have an optional leading whitespace and no trailing whitespace.

Derick Rethans 1:44

Does that also include like exponential numbers in there?

George Peter Banyard 1:48

Yes. However trailing white spaces are not part of the numeric string specification in the PHP language. To deal with that PHP has a concept of leading numeric strings, which are strings which are numeric but like in the first few bytes, so it can be leading whitespace, integer or float, and then it can be whatever else afterwards, so it can be characters, it can be any white spaces, that will consider as a leading numeric string. The distinction is important because PHP will sometimes only accept pure numeric strings. But in some other place where we'll accept leading numeric strings. Of casts will accept whatever string possible and will try to coerce it into an integer. In weak mode, if you have a type hint. It will accept leading numeric strings, and it will emit an e_notice that a non well formed string has been encountered. When you use like a purely string string, you'll get a non numeric string encountered warning. So the main issue with that is that like strings which have a leading whitespace are considered more numeric by PHP than strings with trailing whitespaces. It is a pretty odd distinction to make.

Derick Rethans 3:01

For me to get this right, the numeric string in PHP can have whitespace at the start, and then have numbers. There's a leading numeric string that can have optional whitespace in front, numbers and digits, and then rubbish. Then there's a non numeric string which never has any numbers in it.

George Peter Banyard 3:22

No numbers in the begin

Truncated by Planet PHP, read more at the original (another 17435 bytes)

Sketchbooks – The Designer’s Cookbook

As a food lover, I absolutely adore cookbooks. I have a ton of them – all filled with pages and pages of delicious recipes for me to try and experiment with. Perhaps some of you do as well. My favorite part of a cookbook is the visuals – mouth-watering pictures of food heaven on perfectly arranged plates. It’s enough to send even the casual eater into foodie nirvana.

Most cookbooks I own have wide margins and extra pages in the back to make notes on. Because I’m a total cooking geek, I take full advantage of this feature, making notes of things I’ve tried, adjustments I’ve made to the measurements, different methods of arranging the dish, et cetera. Sometimes I’ll even print out photos I’ve taken of my dinner table to have as a reference.

My favorite method of recording information, though, is sketching. If there’s a complex dessert I have to make that requires a careful assembly, there’s no better way to figure it out than by drawing it. Making a sketch in my recipe allows me to keep a visual record in addition to a written one, so that I can produce an even better outcome next time. In this way, my cookbooks are almost like sketchbooks, and that’s exactly what I’m going to talk about today.

blueberry cake baking sketch sketchbook design
Pancakes by Zhenia Pikul

Sketchbooks – The Designer’s Cookbook

In my opinion, and I’m definitely not alone, designers don’t keep sketchbooks nearly often enough. A sketchbook is possibly the best way to keep track of your ideas and to document your thought process, but many designers – even those who went to school – are afraid of “ruining” a new sketchbook with their “bad” drawings.

This is a silly notion that needs to go away forever. Sketching in a design context is not – I repeat: not – about how well you can draw. It’s a tool to develop your brain. By sketching regularly, you can actually improve your ability to think critically and quickly call up creative solutions whenever you need them.

The earliest cookbooks were simply records of what wealthy, upper-class people ate. They were created not for the wealthy themselves, but for their kitchen staff. Modern recipe books used by chefs serve much the same purpose. They serve as a working guide to help cooks solve their diners’ main problem: they’re hungry and they want a delicious meal.

In this same way, a sketchbook is a visual reference for solving problems. Most cooks I know don’t follow the recipe exactly, and you don’t have to use everything you put down in your sketchbook. It’s simply a reference for you to use – just like a mood board, a wireframe, or a comp or draft.

logo food sketch sketchbook design
Sketchbook Doodles by Derek Clark

Share The Wealth

The days of the “secret recipe” are over. Recently, there’s been an explosion of celebrity chefs who have released their own cookbooks full of recipes developed on their television shows or in their restaurants. Scores of non-celebrity chefs and professional food bloggers are also eager to share what they know. In fact, even people who aren’t chefs, such as Gwenyth Paltrow or Martha Stewart, put out recipe books. Why? Because helping others improves your image.

Sharing what you know can put you in a position of authority, even if you’re not a so-called “expert.” It helps you stand out as someone who is looking to provide value and help people help themselves.

Look, I know how many designers feel about their drawing abilities. But as someone who’s hired designers in the past, I can’t tell you how awesome it is to find one who’s willing to share their sketches and expose the inner workings of their brains. Clients love to see your thought process. It makes them more likely to want to do business with you, rather than the next person.

Your sketches don’t have to be beautiful, and okay – you don’t have to share the ones that look like a kindergarten class had a riot across the page. But sketches that show the way you think are immensely valuable to clients. It helps them see how you will apply your brain to their own projects.

If all you ever share on your website are the polished, finished products in their annoyingly perfect glory, you’re missing out on connecting with people on a personal and intellectual level. Showing nothing but the finished product is dry and boring, and it doesn’t solve your clients’ problems. Your client isn’t paying you for work you did for someone else. They’re paying for the way you approach your designs – the way you think.

typographic design sketch sketchbook design
Sketchbook by Jady Salvatico

Having A Theme

Cookbooks often have a theme – desserts, vegetarian, etc. There are also single-subject cookbooks, dealing with things like pizza, pasta, bread, or any other singular dish. Then there are cookbooks that can instruct you on certain cooking techniques like baking, barbecuing, or cloning recipes for popular commercial foods you would find in a restaurant or grocery store.

It’s not necessary to include every single bit of information related to cooking in every cookbook. No one would ever need or want to buy more than one of them, for one thing. Also, a cookbook that comprehensive, if it existed, would probably be the size of your car.

When sketching and sharing your design “recipes,” it’s a tremendous benefit to pare down the theme of your sketches to whatever is relevant to your project. If you’re coming up with new ways to incorporate animated type in your mobile interface, it’s not really that enlightening if you have a pencil drawing of your dog randomly dropped in.

You don’t need to show every single sketch you do, nor does every sketch have to be inherently useful on its own. Rather, it’s the overall process of keeping records that’s important.

Don’t Forget To Process

If you do start keeping a regular sketchbook, it’s easy to get overwhelmed by the volume of sketches you’ll produce. As a formally trained illustrator, I’ve been keeping sketchbooks for many, many years. I don’t actually throw anything out, but I do have to occasionally put boxes of papers in deep storage because there’s just no room for them in my house.

My reference and inspiration folders are the same way. It’s important to constantly update your resources; if something is no longer useful, get rid of it. Clutter on your hard drive leads to clutter in your work.

The post Sketchbooks – The Designer’s Cookbook appeared first on Speckyboy Design Magazine.

Life after Facebook?

Yesterday was my last day at Facebook. After 9 1/2 years it was high time for a change. I dropped the news on twitter/fb and thought now it would be nice to answer the question of "what's next?" that friends are wondering.

The trajectory

I myself have wondered sometimes what the life after Facebook could look like for different folks. FB is one of the best places to be a software engineer, if not the best. To me, the path to FB took 10 years of upwards movement. DIY sites for other folks, then an lonely web dev at an enterprise company (Allianz), then immigration, start over at a web design studio, then enterprise (SAP), another immigration, Yahoo!, finally Facebook. Always moving to a greener pasture. For other engineers, FB is their first ever paid gig out of college. Where do you go from there, once you start at the top?

Moving to another big Silicon Valley company (where engineers are treated better than anywhere else) is at best a lateral move.

The bubble

And then there's the bubble you're inside of, when working for a FAANG company. The bubble of the big tech co and then an even smaller bubble of the specific company with its super advanced tools you learn to rely on. I've read somewhere that ex-Googlers commonly starting a company spent most of the time initially recreating the great tools they're used to use in their work.

Solo

So, if moving up is not an option (there's no up), how about going different? And how different? I'd say as different as possible. What's different from a big Silicon Valley company? Small. Outside Silicon Valley. And not even a company. In other words going solo. Be more entrepreneurial. Explore a few ideas. And step outside the bubble.

More specifically?

teoriamusica.com

I'm taking music classes in Santa Monica College and in UCLA Extension (film scoring program). As part of my journey from self-taught guitarist to someone who can read and write music, I've being cobbling together online exercises at onlinemusictools.com. Usually a quick CRA done in an evening to help me practice for this week's quiz.

While this site will always be out and free, I'd like to take the time to rebuild it properly, with more tools, esprcially for teachers, tracking progress, etc. Explore more of the WebAudio and WebMIDI APIs. I even got a domain for it - teoriamusica.com.

Is this space too crowded? Is it now the best time for online educational aid? Who knows. The thing is building something takes time and the chances of success are higher if you stick with it. And chances of sticking with it are higher if you work on something you love.

sorty.app

A friend has this other startup idea. How can you manage a product (not a project) so that business/design/engineering folks are on the same page throughout the (hopefully long and always messy) life of a product? sorty.app might have an answer. Exciting, isn't it? So I'll join my friend and we'll build this vision together.

Consulting

Leaving the big tech co bubble may end up meaning you move to a smaller bubble after the initial "hello world!" exploratory phase. Your own bubble. Helping other companies OTOH exposes you to exciting new tech. And I want to this too. So if you need Web Perf or JS consulting, hire me.

Books/edu

O'Reilly has been asking me for second editions to React: Up and Running and JavaScript Patterns. The former I've actually started. And there's an early release out there.

And then can I move beyond books and expand to video or other educational products? Possibly. People tell me they've learned a lot from me. Even changed jobs and as a result have better lives after reading (house, marriage, etc). What an honor! I don't think I'm an exceptional teacher, but maybe I'm providing an interesting angle. Often with programming concepts different people need different ways of explaining to grasp a concept.

Web perf community

I've barely maintained calendar.perfplanet.com. It needs love. Podcast episodes need editing.

I want to do more research that hopefully helps more people with various size web sites and skills. And share more with the community. If you're running a conference, talk to me.

...and music.

There is much to study and practice when it comes to music. Expect to see (erm, hear) me finally starting to finish and release music.

So many ideas

Programming is an interesting activity. There are so many options of things to do.

Am I missing something? Sure. Am I oversubscribing? Possibly. But I want to explore various directions and see what happens. And if nothing works and I realize I've made a mistake leaving Facebook? Well, nothing is irreversible. If it turns out self-employment, lifestyle-business, etc. is not my cup of tea, then I'll gladly join a new team with great people building cool tech.

WordPress 5.5 Beta 2


WordPress 5.5 Beta 2 is now available!

This software is still in development, so it’s not recommended to run this version on a production site. Consider setting up a test site to play with the new version.

You can test WordPress 5.5 beta 2 in two ways:

WordPress 5.5 is slated for release on August 11th, 2020, and we need your help to get there!

Thank you to all of the contributors that tested the beta 1 development release and provided feedback. Testing for bugs is an important part of polishing each release and a great way to contribute to WordPress. Here are some of the changes since beta 1 to pay close attention to while testing.

Some highlights

Since beta 1, 48 bugs have been fixed. Here is a summary of a few changes included in beta 2:

  • 19 additional bugs have been fixed in the block editor (see #23903 and #23905).
  • The Dashicons icon font has been updated (see #49913).
  • Broken widgets stemming from changes in Beta 1 have been fixed (see #50609).
  • Query handling when counting revisions has been improved (see #34560).
  • An alternate, expanded view was added for wp_list_table (see #49715).
  • Some adjustments were made to the handling of default terms for custom taxonomies (see #43517)

Several updates have been made to the block editor. For details, see #23903 and #23905.

Developer notes

WordPress 5.5 has lots of refinements to polish the developer experience. To keep up, subscribe to the Make WordPress Core blog and pay special attention to the developers’ notes for updates on those and other changes that could affect your products.

How to Help

Do you speak a language other than English? Help us translate WordPress into more than 100 languages!

If you think you’ve found a bug, you can post to the Alpha/Beta area in the support forums. We’d love to hear from you!

If you’re comfortable writing a reproducible bug report, file one on WordPress Trac, where you can also find a list of known bugs.

Byte-sized functional programming: Pure functions make testing easy

Byte-sized functional programming: Pure functions make testing easy

When testing stateful code, you have to first set up all of the explicit and implicit state that a given piece of code depends on. If the object you're testing has many dependencies that could be complex, or references global variables, or calls many other routines with their own dependencies, you may be looking at a lot of complex setup that makes testing hard to do effectively.

Pure functions greatly reduce that problem.

A pure function is a function that:

  • has no inputs other than those explicitly specified;
  • has no effect on any value other than the value it returns.

That means there is, by definition, only one place to inject dependencies: the call itself. And there's only one effect to validate: the return value of the function. No need to call a function and check what the effect was on some other value or piece of code: by definition, the only effect is the return value.

If one of the parameters you pass in is itself complex, that may make the test complex. But if the parameter is complex, that can serve as an impetus to simplify it. Rather than passing in an object, for example, just pass in a single function. If that function in practice has more complexity behind it, fine, but it makes passing a mock function trivial. Just... make a new (anonymous) function for the one test.

When your code has fewer sneaky interactions, there's less effort involved in testing as well as fewer things to test.

---

Want to know more about functional programming and PHP? Read the whole book on the topic: Thinking Functionally in PHP.


Thinking Functionally in PHP
Larry 14 July 2020 - 9:28am

Community News: Latest PECL Releases (07.14.2020)

Latest PECL Releases:

  • mysql_xdevapi 8.0.21
    WL#13014 DevAPI: Add schema validation to create collection orabug #30134490: apply helpers from util/object.h orabug #31084747: single doc tests failing in php-7.4 changes in config.m4|w32 to improve resolving 3rdParty libs

  • ast 1.0.7
    - Add the experimental AST version 80 - In AST version 80, support returning `mixed` types as an `AST_TYPE` with type `TYPE_MIXED` instead of an `AST_NAME`. - In AST version 80, support PHP 8.0 attributes for declarations. - Support PHP 8.0's Match expressions. - Support PHP 8.0 constructor property promotion, and allow indicating visibility on AST nodes. Note that `MODIFIER_PUBLIC` and `astAST_PARAM` modifiers had overlap in php 7.4, so the `MODIFIER_*` modifiers are only included in the provided metadata for php 8.0+
  • datadog_trace 0.47.0
    **Deprecation notice**: - Setting service name via `DD_SERVICE_NAME` is now deprecated and will be removed in a future release. Use `DD_SERVICE` instead for consistency with other Datadog tracers and services. - Setting global tags via `DD_TRACE_GLOBAL_TAGS` is now deprecated and will be removed in a future release. Use `DD_TAGS` instead (with the same format) for consistency with other Datadog tracers and services. - `DD_TRACE_RESOURCE_URI_MAPPING` is deprecated now that it has been split into `DD_TRACE_RESOURCE_URI_MAPPING_INCOMING` and `DD_TRACE_RESOURCE_URI_MAPPING_OUTGOING`. - The functions `dd_trace` and `dd_trace_forward_call` are deprecated and will be made a no-op in the next release. See #924 for how to migrate.

    Added

    • Apply new uri to resource normalization rules #928
    • Add DDTrace namespace for internal functions #930
    • Startup logging (can be disabled by setting DD_TRACE_STARTUP_LOGS=0) #935

    Changed

    • Sandboxed cURL (PHP 5) #911, #938
    • Sandbox Lumen (PHP 5) #945
    • Sandboxed Symfony (PHP 5) #946
    • Add support for service name configuration via DD_SERVICE #919
    • Add support for DD_TAGS, fallback to DD_TRACE_GLOBAL_TAGS #920
    • Add support for DD_VERSION and DD_ENV variables #803 - thanks @brettlangdon
    • Enable OpenTracing test suite in CI #921
    • Defaults for name and resource on SpanData #923
    • Refactor dispatch.{c,h} #932
    • Extract ddtrace_sandbox_begin/ddtrace_sandbox_end helpers #940
    • Warn on dd_trace usage if DD_TRACE_WARN_LEGACY_DD_TRACE #941

    Fixed

    • Only build on 64-bit platforms #929 (thanks for the report @remicollet)
    • (PHP 5.4) Make compilation to single file compatible with include __DIR__ . '...' in files #943
  • mongodb 1.7.5
    ** Bug * [PHPC-1639] - Manager::executeCommand() should not inherit read preference
  • redis 5.3.1
    phpredis 5.3.1

    This is a small bugfix release that fixes a couple of issues in 5.3.0.

    You should upgrade if you're using persistent_id in session.save_path or of if you're having trouble building 5.3.0 because the php_hash_bin2hex symbol is missing.

    You can find a detailed list of changes in Changelog.md and package.xml

    • Sponsors ~ Audiomack - https://audiomack.com ~ BlueHost - https://bluehost.com ~ Redis Cache Pro for WordPress - https://wprediscache.com ~ Avtandil Kikabidze - https://github.com/akalongman

    • Properly clean up on session start failure [066cff6a] (Michael Grunder)
    • Treat NULL as a failure for redis_extract_auth_info [49428a2f, 14ac969d] (Michael Grunder)
    • Don't dereference a NULL zend_string or efree one [ff2e160f, 7fed06f2] (Michael Grunder)
    • Fix config.m4 messages and test for and include php_hash.h [83a1b7c5, 3c56289c, 08f202e7] (Remi Collet)
    • Add openSUSE installation instructions [13a168f4] (Pavlo Yatsukhnenko)
    • Remove EOL Fedora installation instructions [b4779e6a] (Remi Collet)
Powered by Gewgley