search
  • Sign In
  • Sign Up
Password reset successful

Follow the proiects vou are interested in andi aet the latestnews about them taster

PHP7 modified functions

Collection 105
Read 69606
update time 2016-09-11
  • The scanner_mode parameter of parse_ini_file() and parse_ini_string() adds the INI_SCANNER_TYPED option.
  • unserialize() adds a second parameter, which can be used to specify the list of accepted classes. RFC: https://wiki.php.net/rfc/secure_unserialize
  • The maximum limit opened by proc_open() was previously hard-coded to 16. Now this limit has been removed. The maximum number depends on what PHP has available. Memory. The Windows version adds the option "blocking_pipes", which can be used to specify whether to force reading in blocks.
  • array_column():The function now supports an array of objects as well as two-dimensional arrays
  • stream_context_create()windows can receive array("pipe" => array("blocking " => <boolean>)) parameter.
  • dirname() adds the option $levels, which can be used to specify the directory level. dirname(dirname($foo)) => dirname($foo, 2);
  • When debug_zval_dump() prints, use int instead of long and float instead of double.


PHP filter unserialize()

PHP 7 has added the ability to provide filtering for unserialize() Features can prevent code injection of illegal data and provide safer deserialized data.

Example

<?php
class MyClass1 { 
   public $obj1prop;   
}
class MyClass2 {
   public $obj2prop;
}
$obj1 = new MyClass1();
$obj1->obj1prop = 1;
$obj2 = new MyClass2();
$obj2->obj2prop = 2;
$serializedObj1 = serialize($obj1);
$serializedObj2 = serialize($obj2);
// 默认行为是接收所有类
// 第二个参数可以忽略
// 如果 allowed_classes 设置为 false, unserialize 会将所有对象转换为 __PHP_Incomplete_Class 对象
$data = unserialize($serializedObj1 , ["allowed_classes" => true]);
// 转换所有对象到 __PHP_Incomplete_Class 对象,除了 MyClass1 和 MyClass2
$data2 = unserialize($serializedObj2 , ["allowed_classes" => ["MyClass1", "MyClass2"]]);
print($data->obj1prop);
print(PHP_EOL);
print($data2->obj2prop);
?>

The execution output of the above program is:

1
2
Hot AI Tools
Undress AI Tool
Undress AI Tool

Undress images for free

AI Clothes Remover
AI Clothes Remover

Online AI tool for removing clothes from photos.

Undresser.AI Undress
Undresser.AI Undress

AI-powered app for creating realistic nude photos

ArtGPT
ArtGPT

AI image generator for creative art from text prompts.

Stock Market GPT
Stock Market GPT

AI powered investment research for smarter decisions

Popular tool
Notepad++7.3.1
Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version
SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1
Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6
Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version
SublimeText3 Mac version

God-level code editing software (SublimeText3)