1--TEST-- 2mysqli_enable_reads_from_master() 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifemb.inc'); 7require_once('skipifconnectfailure.inc'); 8 9if (!function_exists('mysqli_enable_reads_from_master')) { 10 die("skip function mysqli_enable_reads_from_master() not available\n"); 11} 12?> 13--FILE-- 14<?php 15 require_once("connect.inc"); 16 17 $tmp = NULL; 18 $link = NULL; 19 20 if (NULL !== ($tmp = @mysqli_enable_reads_from_master())) 21 printf("[001] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); 22 23 if (NULL !== ($tmp = @mysqli_enable_reads_from_master($link))) 24 printf("[002] Expecting NULL/NULL, got %s/%s\n", gettype($tmp), $tmp); 25 26 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) { 27 printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n", 28 $host, $user, $db, $port, $socket); 29 } 30 31 if (!is_bool($tmp = mysqli_enable_reads_from_master($link))) 32 printf("[004] Expecting boolean/[true|false] value, got %s/%s\n", gettype($tmp), $tmp); 33 34 mysqli_close($link); 35 36 if (NULL !== ($tmp = mysqli_enable_reads_from_master($link))) 37 printf("[005] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp); 38 39 print "done!"; 40?> 41--EXPECTF-- 42Warning: mysqli_enable_reads_from_master(): Couldn't fetch mysqli in %s on line %d 43done! 44