Monthly Archiv: April, 2019

422 Unprocessable Entity

The 422 Unprocessable Entity status-code does not appear in the base HTTP specification. Like 102 and 207 it’s part of the WebDAV specification, which is an extension to HTTP.

Unlike the other two, the 422 code has a good general use-case, and is often used in Web API’s.

The 422 code implies that the server understood the general syntax of the request, but the contents were incorrect. For example, a server might expect POST requests that uses the application/json format. If the request is broken JSON, it might be more appropriate to send back the 400 status code, but if the request is valid JSON but the request doesn’t pass validation (via for example json-schema) returning 422 might be better.

If there was something wrong with the request body, you can use the following rules to figure out what to send back:

  • If the Content-Type was not supported, use 415.
  • Else: If the request was not parsable (broken JSON, XML), use 400 Bad Request.
  • Else: If the request was parsable but the specific contents of the payload were wrong (due to validation or otherwise), use 422

Example

POST /new-article HTTP/1.1
Content-Type: application/json

{ "title": "Hello world!"}
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/problem+json

{
  "type" : "https://example/errors/missing-property",
  "status": 422,
  "title": "Missing property: body"
}

References

Community News: Latest PECL Releases (04.23.2019)

Latest PECL Releases:

  • swoole 4.3.3
    Fixed


    • Fixed Http2 ping frame bug (0f074a61) (371d0b86) (e28ed13c) (@twose) (@shiguangqi)
    • Fixed OSX signal bug (6d06a2c2) (6b66f56c) (@twose)
    • Fixed CoroutineHttpClient->setData (53d9d1ac) (@twose)
    • Remove HAVE_IPV6 (3effad3c) (@matyhtf)
    • PHP7.4 compatibility (#2506) (@twose)
  • event 2.4.4
    Fixed issue #53: EventBase::__construct now throws EventException if the features specified via the EventConfig parameter are not supported on the current platform.
  • runkit7 2.0.3
    - Add missing Reflection parameter information of runkit_import(). - Remove php_runkit_sandbox.h from installed headers on Windows.
  • rdkafka 3.1.0
    * Added timestamp support (@mariam-japaridze) * Added headers support (@martynaszaliaduonis, @dariuskasiulevicius) * Added RdkafkaConf::setConsumeCb(), RdKafkaConf::setOffsetCommitCb() (@tPl0ch) * Added RdKafkaKafkaConsumer::getCommittedOffsets() (@dariuskasiulevicius) * Fixed RdKafkaMessage::errstr() (@JustBlackBird) * Fixed reflection (@carusogabriel) * Allow null key and null message (@awons) * Dropped official PHP 5.4 / 5.5 support (@tPl0ch) * Improved examples (@dbakiu, @Steveb-p)
  • dbase 7.0.0
    Backward Incompatible Changes
    • database link identifiers are now proper resources instead of integers
    • logical values are now retrieved as booleans instead of integers

    New Features

    • FoxPro datetime fields ('T') are now supported as "YYYYMMDDhhmmss.uuu"
    • Uninitialized logical fields are now supported as NULL
    • base_create() now supports an optional $type parameter (either DBASE_TYPE_DBASE or DBASE_TYPE_FOXPRO) to define the type of database to be created
    • FoxPro nullable fields are now transparently supported
    • The $mode of dbase_open() can now be specified as DBASE_RDONLY or DBASE_RDWR
    • The version of the dbase extension is now available as DBASE_VERSION
    • Basic database locking has been implemented
    • Internally the Zend memory manager is now used
    • Error reporting has been improved; e.g. unsupported field type now raise a warning

    Bug Fixes

    • Fixed #39305 (Use of decimal point in different countries)
    • Fixed #52112 (dbase_get_record() returns integer instead of decimal values)
    • Fixed #68289 (wrong strlcpy call)
    • Fixed #72812 (dbase_create does not close the FD on failure)
    • Fixed #72815 (zend_get_parameters_ex() is deprecated)
    • Fixed #73391 (Writing of floats can cause OOB reads)
    • Fixed #73395 (failing dbase_create() may leak memory)
    • Fixed #73411 (dbase_pack() returns TRUE on failure)
    • Fixed #73414 (Unsupported field types may cause dbase_open() to leak memory)
    • Fixed #73442 (Float fields always have precision 0)
    • Fixed #73447 (Floats written to character fields are truncated to integer)
    • Fixed #74983 (SIGABRT when function put_dbf_field is called)
  • imagick 3.4.4RC2
    - The 3.4.4 release is intended to be the last release (other than small bug fixes) that will support either PHP 5.x, or ImageMagick 6.x. The next planned release will be PHP > 7.0 and ImageMagick > 7.0 at least, if not higher. - Added: * function Imagick::optimizeImageTransparency() * METRIC_STRUCTURAL_SIMILARITY_ERROR * METRIC_STRUCTURAL_DISSIMILARITY_ERROR * COMPRESSION_ZSTD - https://github.com/facebook/zstd * COMPRESSION_WEBP * CHANNEL_COMPOSITE_MASK * FILTER_CUBIC_SPLINE - "Define the lobes with the -define filter:lobes={2,3,4} (reference https://imagemagick.org/discourse-server/viewtopic.php?f=2&t=32506)." * Imagick now explicitly conflicts with the Gmagick extension. - Fixes: * Bug 77128 - Imagick::setImageInterpolateMethod() not available on Windows * Prevent memory leak when ImagickPixel::__construct called after object instantiation. * Prevent segfault when ImagickPixel internal constructor not called. * Imagick::setResourceLimit support for values larger than 2GB (2^31) on 32bit platforms. * Corrected memory overwrite in Imagick::colorDecisionListImage() * Bug 77791 - ImagickKernel::fromMatrix() out of bounds write. - Deprecated: * The following functions have been deprecated: ImagickDraw, matte Imagick::averageimages Imagick::colorfloodfillimage Imagick::filter Imagick::flattenimages Imagick::getimageattribute Imagick::getimagechannelextrema Imagick::getimageclipmask Imagick::getimageextrema Imagick::getimageindex Imagick::getimagematte Imagick::getimagemattecolor Imagick::getimagesize Imagick::mapimage Imagick::mattefloodfillimage Imagick::medianfilterimage Imagick::mosaicimages Imagick::orderedposterizeimage Imagick::paintfloodfillimage Imagick::paintopaqueimage Imagick::painttransparentimage Imagick::radialblurimage Imagick::recolorimage Imagick::reducenoiseimage Imagick::roundcornersimage Imagick::roundcorners Imagick::setimageattribute Imagick::setimagebias Imagick::setimageclipmask Imagick::setimageindex Imagick::setimagemattecolor Imagick::setimagebiasquantum Imagick::setimageopacity Imagick::transformimage

Significant Symbols

Significant Symbols

Last week a person on the #php IRC channel on freenode, mentioned that he had problems loading some extensions with his self-compiled PHP binary. For example, trying to activate the timezonedb PECL extension failed with:

sapi/cli/php:
        symbol lookup error: /usr/local/php/extensions/debug-non-zts-20180731/timezonedb.so:
        undefined symbol: php_date_set_tzdb

Which is odd, as the php_date_set_tzdb is a symbol that PHP has made available since Date/Time support was added. I asked the user to check whether his PHP binary exported the symbol by using nm, and the answer was:

$ nm sapi/cli/php | grep php_date_set_tzdb
000000000018bc75 t php_date_set_tzdb

The small letter t refers to a local only text (code) section: the symbol was not made available to shared libraries to use. In other words, extensions that make use of the symbol, such as the timezonedb extension can not find it, and hence fail to load.

In PHP, the php_date_set_tzdb function is defined with the PHPAPI prefix, which explicitly should mark the symbol as a global symbol, so that shared libraries can find it:

PHPAPI void php_date_set_tzdb(timelib_tzdb *tzdb)

The PHPAPI macro is used, because on Windows it is required to explicitly make symbols available:

#ifdef PHP_WIN32
#       define PHPAPI __declspec(dllexport)

On Linux (with GCC) symbols are made available unless marked differently (through for example the static keyword).

When looking into this, we discovered that his PHP binary had no exported symbols at all.

After doing a bit more research, I found that more recent GCC versions support a specific compiler flag that changes the default behaviour of symbol visibility: -fvisibility=hidden. In recent versions of PHP, we enable this flag if it is supported by the installed GCC version through a check in the configure system:

dnl Mark symbols hidden by default if the compiler (for example, gcc >= 4)
dnl supports it. This can help reduce the binary size and startup time.
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden],
                      [CFLAGS="$CFLAGS -fvisibility=hidden"])

As this makes all symbols hidden by default, the same commit also made sure that when the PHPAPI moniker is used, we set the visibility of these specific symbols back to visible:

#   if defined(__GNUC__) && __GNUC__ >= 4
#       define PHPAPI __attribute__ ((visibility("default")))
#   else
#       define PHPAPI
#   endif

When the original reporter saw this, he mentioned that was using an older GCC version: 3.4, and that he could see the -fvisibility=hidden flag when running make, just like here:

… cc -Iext/date/lib … -fvisibility=hidden … -c ext/date/php_date.c -o ext/date/php_date.lo

Because his GCC supported the -fvisibility=hidden flag, the check in the configure script enabled this feature, but because his GCC version was older than version 4, the counter-acting ((visbility("default"))) attribute was not set for symbols that are explicitly marked with the PHPAPI specifier. Which means that no symbols were be made available for shared PHP extensions to use.

The user created a bug report for this issue, but as GCC 3.4 is a really old version, it seems unlikely that this issue will get fixed, unless somebody contributes a patch. In the end, it was quite a fun detective story and to get to the bottom of this!

FormOne

Package:
FormOne
Summary:
Generate HTML form composed programatically
Groups:
HTML, PHP 5
Author:
Jorge Castro
Description:
This class can generate HTML form composed programatically...

Read more at https://www.phpclasses.org/package/11175-PHP-Generate-HTML-form-composed-programatically.html#2019-04-22-22:00:38

Mevolv Weight Loss Pills: Why You Need To Lose Weight?

Download PDFDownload PDF

Many people out there understand the need for weight loss and they work in the way to decrease weight or lose body fat. They want to remain in shape and fit so that they do not face any risk due to obesity. There are many diseases as well as health risks related to obesity hence one must be alert and conscious about their health from the very start. Mevolv weight loss pills are one of the supplements which can help you achieve the motto of losing weight without much headache.

You might be wondering what mevolv is and how it may help you, right? Read this article we will tell you everything. Mevolv is well-known body building hub that educates as well as helps an individual to accelerate muscle growth and get into shape. At mevolv, you get the reviews of the dietary supplements as well as products which are well known in the bodybuilding industry. Here in this article, we will see the top reviewed product by Mevolv and on the basis of information available here you will be able to make better choices for weight loss benefits.

1. PhenQ-

This product is very well accepted by customers in different countries. This is a revolutionary weight loss product. The direction of the use of this product is easy and the results in you get by using it is quite accurate. This drug helps to increase metabolism rate, burns extra fats at a faster rate and this is how it makes you slimmer.

The consumer has to take one pill before breakfast and one after lunch. So, recommended doses are 2 pills a day. This supplement contains ingredients which are formulated to maximize the energy levels in a body. People who are sensitive to caffeine must limit their coffee intake as well as this product already contains some amount of caffeine.

2. Garcinia Extra-

Garcinia cambogia is basically a pumpkin shaped fruit which grows in India and southeast Asia. Its active element is present in rind that is HCA or hydroxycitric acid. The researcher believes that this constituent of this fruit helps to lose weight. The HCA boosts the fat burning potential and so successful weight loss results are seen. In some studies, it has also been claimed that garcinia helps in lowering cholesterol. Garcinia in addition to this also lowers blood sugar level which further help overcome heart diseases and diabetes.

3. Phen375-

This fat burning supplement is also seen as effective in losing weight. This is FDA approved supplement and you can take it without proper prescription for free weight loss. This drug work by the following mechanism- boost energy, antidepressant and hardcore thermogenesis, which in turn helps lose weight. The main ingredient of this drug are- calcium carbonate, L-Carnitine, chromium picolinate, cayenne pepper, etc.

4. Zotrim-

The unique combination of the damiana, guarana and yerba mate extracts in zotrim are responsible for weight loss. Yerba mate helps reduce hunger as well as fatigue. It has a high amount of antioxidants and also increases energy. Guarana contains caffeine which raises your metabolism, helps release fats.

Damiana leaf extract improves mood and helps resist the urge to have food. So, this three-ingredient together makes this zotrim formula a best weight loss supplement and shows better effects with lesser side effects.

5. Clenbuterol (Clen) fat burner-

Clen stimulates the heart as well as CNS. Its effect on the body is similar to amphetamines as well as epinephrine. It is also known as beta 2 agonist that is opposite of beta blocker. This drug was initially used as the asthma drug however now many athletes and bodybuilders use it to lose weight. The clen works by increasing metabolism of the user and reducing body fats. This allows the user to keep hold of muscle mass as well as body strength.

Now, let us come back to the topic of why we must lose weight? There are many who are just ok with their weight but it’s not about being ok. If you don’t lose weight then in the future you might not be ok. So, it is important that you learn that why losing weight is necessary!

Health-

Carrying more weight does not necessarily mean that you are not healthy. But this may lead to many challenges like heart risk, cancer gallstones, diabetes 2, etc. When you regularly check weight and your weight is increasing slowly and slowly then this means it is surely going to impact your lifestyle as well as health.

Live long as well as prosper-

This is the main reason to lose weight. Research showed that people with obesity have a shorter life than one without much weight. Hence, if you are facing obesity then it becomes necessary for you to lose weight and increase your life span. This way you can enjoy your life a little longer and stay with your loved ones more.

Self-image as well as confidence-

Excess weight makes you look bad; it also lowers your confidence, makes you depressed and lowers your esteem. This has a direct effect on relationship, career, lives. So, losing weight becomes necessary as good body helps you build a good image and regains your self-confidence. You can thus, improve relationship, lives and make progress in the career.

So, these were the reasons to lose weight and we have already listed the weight loss supplements. Mevolv has more content related to weight loss and it will be beneficial for a workout. You can follow some tips like eating egg in breakfast, having green tea and doing some workout along with taking supplements. In this way, in a short time period, you will see more weight loss. This will make you boost your lifestyle and make you happier than ever.

So, stop being depressed today, as tomorrow will be a brighter day for you. You just need to stick to some rules and have some proper drug which makes you achieve your goals faster than ever. If you want you can consult the doctor before using any drug.

Download PDFDownload PDF

Article source: http://theinscribermag.com/mevolv-weight-loss-pills-why-you-need-to-lose-weight/

ircmaxell’s blog: A PHP Compiler, aka The FFI Rabbit Hole

It’s no secret that I’m into building toy compilers and programming languages. Today I’m introducing something that’s not a toy (I hope). Today, I’m introducing php-compiler (among many other projects). My hope is that these projects will grow from experimental status into f...

How to validate the right email address format in PHP?

Receiving email messages via your website or web application is an important feature and often the only way to get in contact with your customers. If you look back, how often have you got an email message from a potential customer with an invalid or wrong email address? Sure you can use advanced regular expression […]

Originally published by Web Development Blog

Powered by Gewgley